Notepad++ lost track of open files / why?
-
@pnedev sorry my reply took so long. here you are. it won’t let me upload / attach the log file here so this is the content (there was nothing sensitive in it so this is fully intact):
2022-07-25 11:08:22 WM_QUERYENDSESSION =====================================
2022-07-25 11:08:24 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml is opened.
2022-07-25 11:08:24 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml 8015/8015 bytes are written.
2022-07-25 11:08:24 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml is closed.
2022-07-25 11:08:24 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml is opened.
2022-07-25 11:08:24 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml 3683/3683 bytes are written.
2022-07-25 11:08:24 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml is closed.
2022-07-25 11:08:24 WM_ENDSESSION
2022-07-25 11:08:24 WM_DESTROY
2022-08-19 10:43:58 WM_QUERYENDSESSION =====================================
2022-08-19 10:43:58 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml is opened.
2022-08-19 10:43:58 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml 8256/8256 bytes are written.
2022-08-19 10:43:58 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml is closed.
2022-08-19 10:43:58 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml is opened.
2022-08-19 10:43:58 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml 6047/6047 bytes are written.
2022-08-19 10:43:58 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml is closed.
2022-08-19 10:43:58 WM_ENDSESSION
2022-08-19 10:43:58 WM_DESTROY
2022-08-23 12:10:06 WM_QUERYENDSESSION =====================================
2022-08-23 12:10:07 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml is opened.
2022-08-23 12:10:07 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml 8256/8256 bytes are written.
2022-08-23 12:10:07 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml is closed.
2022-08-23 12:10:07 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml is opened.
2022-08-23 12:10:07 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml 5434/5434 bytes are written.
2022-08-23 12:10:07 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml is closed.
2022-08-23 12:10:07 WM_ENDSESSION
2022-08-23 12:10:07 WM_DESTROY
2022-08-23 23:44:57 WM_QUERYENDSESSION =====================================
2022-08-23 23:44:58 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml is opened.
2022-08-23 23:44:58 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml 8256/8256 bytes are written.
2022-08-23 23:44:58 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml is closed.
2022-08-23 23:44:58 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml is opened.
2022-08-23 23:44:58 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml 5430/5430 bytes are written.
2022-08-23 23:44:58 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml is closed.
2022-08-23 23:44:58 WM_ENDSESSION
2022-08-23 23:44:58 WM_DESTROY
2022-09-12 14:54:17 WM_QUERYENDSESSION =====================================
2022-09-12 14:54:17 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml is opened.
2022-09-12 14:54:17 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml 8352/8352 bytes are written.
2022-09-12 14:54:17 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml is closed.
2022-09-12 14:54:17 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml is opened.
2022-09-12 14:54:17 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml 3707/3707 bytes are written.
2022-09-12 14:54:17 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml is closed.
2022-09-12 14:54:17 WM_ENDSESSION
2022-09-12 14:54:17 WM_DESTROY
2022-09-14 01:23:48 WM_QUERYENDSESSION =====================================
2022-09-14 01:23:48 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml is opened.
2022-09-14 01:23:48 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml 8366/8366 bytes are written.
2022-09-14 01:23:48 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml is closed.
2022-09-14 01:23:48 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml is opened.
2022-09-14 01:23:48 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml 3709/3709 bytes are written.
2022-09-14 01:23:48 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml is closed.
2022-09-14 01:23:48 WM_QUERYENDSESSION =====================================
2022-09-14 01:23:48 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml is opened.
2022-09-14 01:23:48 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml 9398/9398 bytes are written.
2022-09-14 01:23:48 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml is closed.
2022-09-14 01:23:48 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml is opened.
2022-09-14 01:23:48 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml 193/193 bytes are written.
2022-09-14 01:23:48 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml is closed.
2022-09-14 01:23:48 WM_ENDSESSION
2022-09-14 01:23:48 WM_DESTROY -
@Fabian-Santiago ,
Thank you. I hope it will be useful and give some insight on the cause of the problem.BR
-
Thanks for the log!
Do you have your N++ autoupdate set ON? (Preferences -> MISC. -> Enable Notepad++ auto-updater checked)
This is the same pattern as in here.
The relevant thing is the last surprising duplicate of the WM_QUERYENDSESSION log, where the session.xml file evidently gets emptied (“2022-09-14 01:23:48 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml 193/193 bytes are written.”)
So we are getting a little bit closer - now let’s discuss how this could happen.
If there were slightly different times in the duplicate log items at the end, I could suspect some N++ multi-instancing problem or N++ zombie/crashed process behind, but we have the same log-time everywhere. So I do not think so.
If it was a racing condition, the last two WM_QUERYENDSESSION items would probably be mixed together. So I do not think so.
I’m wondering if it cannot be a coincidence with the N++ autoupdating.
Any other thoughts?
-
@xomx
At the same time config.xml gets 1032 bytes bigger. Quite a big difference. -
@xomx yes i do:
-
Maybe it could be interesting to see the content of such config.xml too.
Now about something else - I have just checked the relevant N++ shutdown source code and I have the following crazy idea (I have not tested/debugged that yet):
- the WM_QUERYENDSESSION and WM_CLOSE messages share the same code part
- at the standard (user initiated closing of the N++ app) N++ shutdown, the N++ receives only the WM_CLOSE one from these two
- when a Windows restart occurs, while the N++ is still opened, the N++ receives both of them, WM_QUERYENDSESSION 1st and the N++ executes the same code part as the WM_CLOSE, then returns TRUE (when an user did not cancelled the Windows restart/shutdown)
- when an app sent TRUE to the Windows OS as a response to the WM_QUERYENDSESSION, that app shutdown continues, so the app should obtain the WM_CLOSE sometime later!
- and I think that this “double-execution” of the same code part can be the culprit
Look at this part - I think that during the 1st execution all the opened files are closed, so at the 2nd execution the session has not any opened files to store!
If I am right, the solution is to handle the WM_QUERYENDSESSION and WM_CLOSE separately.
-
@xomx said in Notepad++ lost track of open files / why?:
If I am right, the solution is to handle the WM_QUERYENDSESSION and WM_CLOSE separately.
I haven’t looked at the code myself yet but that is a very good assumption @xomx .
Could you also share your
Backup
settings tab?
Thank you once again for the debug input. -
@pnedev yes:
-
@xomx , All,
I suspect that on occasions the periodic session backup might be triggered while in the process of WM_QUERYENDSESSION but that needs further investigation.
BR
-