Notepad++ crashes and erases the file being worked on.
-
If you are going to stick with your version 7.2, I would suggest you turn all “backup” options off…and see what happens going forward…good luck.
-
I’m sorry again for slow responses, I get site error ‘HERE’
if I do anything other than enter a preprepared response.
This site won’t let me edit or immediate reply. prefer not to get wrapped up in all that as I already
have a nice little problem to work on.If not the v7.2 is there a version attainable you might recommend?
Thank you, So if I have this correct, I will go to my version 7.2 under:
Settings > Preferences > Backup
and uncheck the ‘Remember current session for next launch’? and
uncheck the 'Enable session snapshot and periodic backup,
remove the timer variables if they need removed after these are unchecked (I’m assuming they wont)
remove path, and leave None as None.Erasing ones programs is beyond MESSED UP, I would expect that kind of thing as a ploy for an
application to get one to turn pro/ proprietary ware, or a competitors taking advantage
of a weakness or vulnerability. thank you all again for your time. I see no real
altermative but to try to find another useable code editor, preferably one
that doesn’t just up and erase my stuff. -
I’m sorry, I couldn’t understand well your last post.
You know, every program has it’s flaws (some might be really critical), they stay dormant and unnoticed but when they appear and are known they get fixed and the cycle repeats.If you decide to continue using Notepad++ get version 7.6 or bigger and you shouldn’t have problems like the one you described.
-
I am amazed that so many people are having this problem, for so many years, and still there is no solution to it.
What’s the use of coding in so many features and functionality when basic stability is not looked at.
Today is 12-Mar-2020 and Win10 I believe updated overnight, and when I relaunch Notepad++ the whole session (a mix of saved and unsaved files) has disappeared, and I stare at a Blank file.
Obviously, no error messages, and hence no dump files, etc.I have ticked “Remember Current Session for next Launch”
And also “Enable Session Snapshot and Periodic Backup”. with a Backup every 7 seconds.But what is the Use of having a Session Backup System which will ditch you when you need it the most.
If there is a Periodic Session Backup system, then where are the Previous Backups. Can Notepad++ not recognize when it is over-writing a File with Data, with a Blank file.
We of course appreciate the Functionality of Notepad++ and fall heavily on it. We build our castles on it, and then type out data trusting it to keep it intact. And just when we least expect it, it pulls the rug from under the feet, and presents us a Neat Blank Page…
-
Don’t know for sure but I recommend for you to disable “Session Snapshot and Periodic Backup”.
I believe it is part of the problem rather than the solution.Notepad++ like other legacy GUI applications is almost entirely single threaded running the Windows message loop.
Last time I looked (admittedly long ago) it seemed that the snapshot feature adds multithreading into Notepad++ which is not properly synchronized/locked with the rest of the single threaded code. I believe that if “shit happens” when this backup thread is active, either files may be wiped or empty files are written into the backup and these empty files are restored on the next restart overwriting the OK files. I never enabled this feature and never lost a file.Feel free to use “Remember Current Session” since this feature just tell the main thread to save file locations before Notepad++ exits.
Some people are so lazy/unresponsible that they never save files and expect the snapshot to remember their modified files. But they really deserve to lose a few hours (or days) of work from time to time.
-
@gstavi ,
You are totally right about Notepad++ being mainly single-threaded and that the periodic backup uses multi-threading but that is not the problem.
I made PR maybe a year ago that fixed possible race conditions between the threads and it was merged. I also tested it at the time, @Claudia-Frank tested it too and periodic backups proved to be working properly.The problem remains to be the disk write caching that delays the actual write to the disk which leads to loss of data on sudden power loss or reboot (due to update for example).
I actually did this PR to fix the problem and in relation to these reported issues (https://github.com/notepad-plus-plus/notepad-plus-plus/issues/6133 and https://github.com/notepad-plus-plus/notepad-plus-plus/issues/5664) but it was rejected.Don has written in the release notes of the latest Notepad++ version this:
Fix Notepad++ doesn’t exit correctly while Windows 10 update restart.
I don’t know if that helps though and in what cases.
Here is the link: https://notepad-plus-plus.org/downloads/v7.8.5/
I’m sorry for your data loss, Notepad++ can really do better in that situation but I would advise you to always save your work and close Notepad++ when leaving the computer for longer periods (especially don’t leave it open overnight) to minimize the chances of this happening.
You could try using Recuva to try recovering your lost files.BR
-
@pnedev
Since I looked at the code much longer ago than 1 year then perhaps you fixed the things I saw back than.
I hope you indeed fixed ALL the races because this is one of the more difficult challenges for SW developers.I am not convinced about disk caching explanation because this should have made it a common problem for lots of application.
If it helps in any way I also made a patch that changes Notepad++ file api. My reason was that fopen was resetting file permissions and ownership over SAMBA. Specifically losing the ‘execution’ permission of script files. Perhaps a combination of reasons will convince @donho at some point.
Do remember it if you ever choose to fix the out-of-space bug by creating a new file since it will introduce the same problem. A new file will have default permissions rather then the possibly specific permissions of the original file. -
@gstavi ,
Good points.
I hope you indeed fixed ALL the races
I did. Those related to periodic backups.
I am not convinced about disk caching explanation because this should have made it a common problem for lots of application.
It is apparently a common problem for other applications too.
Here is another debate on the topic:
https://community.notepad-plus-plus.org/post/48725Your patch looks good but to avoid the disk caching problems you need to use
FILE_FLAG_WRITE_THROUGH
(or in your used Win API it should be_WRITE_THROUGH
, I’m not sure) when creating/opening the files.As I’ve written before in several places the problems are two:
fopen
erases file contents on open with write permissions. This is causing the “no-space on disk” file contents loss problem and perhaps the problem you have encountered and are mentioning here.- File contents loss on reboot/power loss (even when files are edited and saved) are caused by disk write caching (defined by Microsoft as “lazy writer” in some of their documents).
Perhaps a combination of reasons will convince @donho at some point.
I doubt it. A lot of people (including me) had given him a lot of reasons already including the root cause of the problems and a possible fix.
Do remember it if you ever choose to fix the out-of-space bug by creating a new file
I though about it in the beginning when I was trying to figure out the cause of the write issues.
In my PR I actually use native Win32 file handling API as you do in your patch to avoid the
fopen
file contents erasure. There is no need to create new file in that case - forget that I mentioned it (it was just a possible and sub-optimal workaround to the first problem I gave above).