Qt Creator deletes file content without any reason!
-
It's more than senseless and I have no idea, why it did that.
I got the problem, that my whole system was frozen and I didn't know why. Qt Creator was opened, but not active and a cpp file was opened. I reset my PC through pushing the reset button, booting Linux again und opened Qt Creator again. Now, Qt Creator has completly deleted the content of my file. The file has a size of 0 bytes, even eclipse nor gedit can open the file. I always get an I/O-error. Eclipse write:
@Error retieving content description for resource@Now, I lost all my code without any reason :(
I will now switch back to Eclipse. There, I don't have the auto-fill in Signals/Slots and no easy F1 for help, but tabs and I never lost there my data...
A really bad bug.... -
The most likely reason is that the cpp file was not yet written do the disk (vfs cache, hard-drive cache etc...) Hard reset like you had to do are never without consequences (even minimal), losing data is nothing QtCreator specific in your case, it could have happened with any editor be it kate/KDevelop/vi/etc...
One thing that would be interesting is to look through your log files to find what did froze your system in the first place.
-
I did not save the data. It doesn't get frozen, when Qt Creator was active. And it is true, this could be possible but iff I save the file during getting frozen, and not when the editor is inactive. No other program was active and used this file in any way.
EDIT: Active means in this case, that it was running in the backgrund while I opened another program, which was the reason for my crash.
-
Hey, if you didn't save the data, then there is really no reason to blame anybody but yourself!
And in any case, even if QtC was "inactive", the Operating System is working all the time... and it's the OS that is ultimately responsible for I/O communication. If it hangs and corrupts the file, all kind of things can happen. This also depends on the filesystem a lot (FAT32 is notorious for loosing the partition table on errors, for example).
Unless you verify with greater degree of certainty that this is Qt Creator's fault, there is simply no case here. Accidents do happen. Are you able to reproduce this in any way (I understand you have reasons not to want to reproduce this :) but it would help)?
QtC periodically rebuilds it's file index, maybe that is when OS crashed.
-
[quote author="sierdzio" date="1362061342"]
QtC periodically rebuilds it's file index, maybe that is when OS crashed.[/quote]Nice, I don't want that, if a crash means loosing data. For that, open the file in read-mode, copy a backup and then write it. After sucess, delete the backup file. If something happens, I have the backup file. But saving and writing files without given any command is not correct! It would be my fault, if my systems crashes, when I save my file.
The OS is not working on any files in my filesystem without any reasons! Why my picture are not corrupted during displaying it? Why my FAT partition is not broken during mounting it? Why should my OS write every time a new partition table for reading data or manipulate an image during displaying? I never loose data in that way before...
My system crashes during using hterm and opening a COM port with getting lots of data from there. I lost the connection and then, it got frozen. That happens not often but sometimes (because of plugin/plugoff /dev/ttyUSB0)
-
Mate, I totally don't understand you now. You have opened the topic saying that you have lost data after OS freeze. Me and SGaist tried to find any way in which that could happen, and explain to you what might be the cause.
Now, after several hours, you have told me this:
- "I did not save the data"
- "My system crashes during using hterm and opening a COM"
So you knew your OS can hang, yet you did not save the file, and then persist in blaming Qt Creator for your (or your USB device driver) error.
Or am I misunderstanding the situation?
As for working on file copies, that indeed might be a very good suggestion. I don't think QtC does this right now, at least I don't remember ever seeing temp files generated by it (while Kate, for example, certainly does that). On the other hand, as far as I know, it simply works on a local copy stored in memory. You can suggest doing hard backups using "JIRA":https://bugreports.qt-project.org/secure/Dashboard.jspa.
[quote]The OS is not working on any files in my filesystem without any reasons! Why my picture are not corrupted during displaying it? Why my FAT partition is not broken during mounting it? Why should my OS write every time a new partition table for reading data or manipulate an image during displaying? I never loose data in that way before…[/quote]
You have just been lucky, then. It's not working on files only when it's turned off. I/O is in constant use on modern OSes (port communication, network connection, file indexing, etc.).
-
[quote author="sierdzio" date="1362073657"]
So you knew your OS can hang, yet you did not save the file, and then persist in blaming Qt Creator for your (or your USB device driver) error.Or am I misunderstanding the situation?[/quote]
Yes, you misunderstood the situation.
the file was saved completly. I didn't changed anything of it. Then, it crashed (not during saving). After rebooting the file was empty without any reason.
I compiled the code with its content. The file cannot be empty, it exists since one week.[quote]As for working on file copies, that indeed might be a very good suggestion. I don't think QtC does this right now, at least I don't remember ever seeing temp files generated by it (while Kate, for example, certainly does that). On the other hand, as far as I know, it simply works on a local copy stored in memory. You can suggest doing hard backups using "JIRA":https://bugreports.qt-project.org/secure/Dashboard.jspa.[/quote]
I normaly use SVN, but in QtC, It is a little bit more complicated to commit files. So I switched now back to Eclipse with a Subversion integration (Subclipse) which works fine.
[quote]
You have just been lucky, then. It's not working on files only when it's turned off. I/O is in constant use on modern OSes (port communication, network connection, file indexing, etc.).[/quote]So I am lucky since I was born until today... okay, I completly wrote the cpp file again. But normaly, it shall be impossible, that the access to a readed file should not change the file in any way, also if your system/program crashes. What happened, when suddently QtC crashes? Must I be afraid of loosing data also if the data was saved on the hard drive?
-
Thanks, that's a bit clearer now. I was getting really confused ;)
I'm not sure what might cause that. I would suspect the file system somehow corrupted the file index (or whatever your fs is using), so your data was not exactly lost (data recovery software may be able to find it). Ping Qt Creator developers if you can and want to, although without being able to reproduce the issue repeatedly I doubt it can be really fixed. And I still won't say that QtC is responsible, that all sounds like simply an accident concerning the trio: OS, filesystem and Qt Creator.
-
But how is that possible?
I thought also, I could recover it, but I didn't have a recovery software installed and it maybe, that during installing, I lost (overwrite) the lost data. Maybe only the Hard-/Softlink are wrong, but I don't know, how to fix or to find the right one. So I wrote every function again.
-
Strange that you're not using any backups, or git (or SVN you've mentioned). I keep my projects on my HDD, gitorious and github simultaneously.
[quote]But how is that possible?[/quote]
I've said it a few times already - I don't know, details of file system architectures and their communication with the OS are not my topmost interest ;). I know fat32 is a very bad and vulnerable FS, but you said you're using Linux (good for you, by the way :)) so you're probably on ext or btrfs, which are much less likely to fail.Quoting "wikipedia":http://en.wikipedia.org/wiki/Journaling_file_system:
[quote]For example, deleting a file on a Unix file system involves two steps:
Removing its directory entry.
Marking space for the file and its inode as free in the free space map.
If a crash occurs between steps 1 and 2, there will be an orphaned inode and hence a storage leak. On the other hand, if only step 2 is performed first before the crash, the not-yet-deleted file will be marked free and possibly be overwritten by something else.[/quote]There you have a possible way how your data loss can occur, even if it sounds a bit illogical.
-
[quote author="sierdzio" date="1362085896"]Strange that you're not using any backups, or git (or SVN you've mentioned). [/quote]
I am not commiting every single line ;)
And as you know, Subversion is maybe not as actual as Git. That's maybe also the reason, why the integration of SVN is not so good in QtCreator.[quote]But how is that possible?[/quote]
I've said it a few times already - I don't know...[/quote]But maybe someone other knows ;)
You are not the only one here, aren't you :) ?
Now, don't worry about my lost data: The file is written again, maybe with less comments and junk-code. -
same here. OS (ubuntu) crashed and qtcreator deleted file content of open (saved!) file. no chance to restore it (not even through git!?).
-
sorry, have to correct: restored the file via git, but the content changes since last commit are definitely gone :(
-
Similar problem but perhaps more details:
I was repeatedly editing, compiling and running a unit test file with QTcreator. It runs on Ubuntu 12.04, on a VM, on a windows machine.
I powered off the VM, with QT creator open but the file saved. Normally I suspend the VM, but occasionally I do this. I was also off my normal work network as I was working while commuting. Starting the workday I launched QTCreator, and the unit test.cpp file came up empty. The moc file shows all the tests I wrote on the commute.
BTW, the VM disk settings are permanent "Changes are immediately and permanently written to disk" -
My version of QtCreator was built August of 2002. I can report a similar issue that is driving me up the wall. The real problem of course is that my raspberry pi is crashing a lot for some unknown reason but I've done everything I can to control data loss within Qt. I am saving my files regularly and when I leave my station I either have saved all the files or I have closed them so none are open. When the crashes occur I typically see the .pro.user.N file zeroed out as well I'll see one of the recently edited files zeroed out even though it had been saved and there had been no recent changes. I have even seen it happen to a file I know wasn't an open document (although it was recently edited).
What bothers me is that I know QtCreator is keeping a backup of the files because when I wasn't being careful early on sometimes I'd get a Qt alert saying it had restored a file.
I am using git but I'm not in the habit of checking things in multiple times a day.
Where I know I can't blame QtCreator for the crashing I can't help but think there is something amiss with the way it is allowing file handles to stay open that aren't actually in use. And I certainly cannot control the [project].user.N file that has user settings in it. This file is routinely corrupted and I have to reinitialize user settings. This file certainly shouldn't be open all the time allowing the OS to corrupt it.
-
My version of QtCreator was built August of 2002. I can report a similar issue that is driving me up the wall. The real problem of course is that my raspberry pi is crashing a lot for some unknown reason but I've done everything I can to control data loss within Qt. I am saving my files regularly and when I leave my station I either have saved all the files or I have closed them so none are open. When the crashes occur I typically see the .pro.user.N file zeroed out as well I'll see one of the recently edited files zeroed out even though it had been saved and there had been no recent changes. I have even seen it happen to a file I know wasn't an open document (although it was recently edited).
What bothers me is that I know QtCreator is keeping a backup of the files because when I wasn't being careful early on sometimes I'd get a Qt alert saying it had restored a file.
I am using git but I'm not in the habit of checking things in multiple times a day.
Where I know I can't blame QtCreator for the crashing I can't help but think there is something amiss with the way it is allowing file handles to stay open that aren't actually in use. And I certainly cannot control the [project].user.N file that has user settings in it. This file is routinely corrupted and I have to reinitialize user settings. This file certainly shouldn't be open all the time allowing the OS to corrupt it.
Hi @ifrisbie,
my raspberry pi is crashing a lot for some unknown reason but I've done everything I can to control data loss within Qt.
To clarify: Do you mean you run Qt Creator on your Raspberry Pi itself, and compile your code on the RPi?
My version of QtCreator was built August of 2002.
I presume you meant August of 2012? That's very old. Please try the latest version, Qt Creator 3.5.0 (released on 20 August 2015).
Do you still experience the same issues on this version? If so, please submit a report to https://bugreports.qt.io/ with all the details you've written here (plus the model of your Raspberry Pi). The Qt Creator team might be able to find ways to make it more robust against crashes.