photools.com Community

IMatch Bug Reports and Feature Requests => Bug Reports => Solved Bug Reports (for next version) => Topic started by: ben on April 02, 2024, 10:14:52 PM

Title: [NF] iMatch crashes if Win11 restarts while iMatch is running
Post by: ben on April 02, 2024, 10:14:52 PM
Problem:
iMatch crashes and (tries) to write a dump file, if Win11 gets restarted while iMatch is running.

Reproduce it:

Comments:

Ben
Title: Re: iMatch crashes if Win11 restarts while iMatch is running
Post by: Mario on April 03, 2024, 09:00:19 AM
Well, when Windows decides to terminate IMatch in mid run, there is little IMatch can do. IMatch is sent to sleep when you send Windows to sleep or close the lid. But rebooting the operating system while applications like database servers (which IMatch actually is) is not a good idea.

Windows will ask you in this case, but if you say yes or ignore the prompt, Windows till terminate all applications and background services and reboot.

IMatch has a setting (Edit > Preferences > Application) that prevents the system from sleeping while IMatch is busy ingesting files. I don't know if Windows offers a feature for applications to prevent Windows from rebooting without properly closing the application first. I know there are functions to initiate a shut-down, but they require the application to run with specific privileges. Not even services can block Windows from shutting down. There are group policies to delay shut-downs or schedule them for specific hours, but nothing can prevent a reboot e.g. after installing important updates.

Usually IMatch should not crash, though. But IMatch may be in a WIC call at the time, or in a DirectX call or one of the 3rd party libraries and components it uses does not deal with the unexpected reboot well...

Did you upload the DUMP file and sent me a link?

Update

I've checked and IMatch does all the mumbo-jumbo when Windows sends the WM_QUERYSHUTDOWN message.
If IMatch is currently not "prepared" to shut-down, it asks Windows to stop / delay the shut-down and to show the user this message "Database is still open and busy." You see this in the "n applications need to close" dialog Windows shows when applications are running and not prepared for a shut-down.
IMatch then shuts down itself as quickly as possible and when the database is closed, it tells Windows that the reboot is now allowed.

Jeez. I'm sometimes smarter than I think (https://www.photools.com/community/Smileys/photools/ashamed03.gif) (https://www.photools.com/community/Smileys/photools/rolleye11.gif)

Anyways, even when IMatch does all that, there is always a chance that something unexpected happens, or that the database takes to long to shut-down and Windows loses patience or that the user clicks "Force shutdown" in the dialog etc. Impossible to tell after the fact.

The DUMP file produced would be interesting. Can you upload it to your cloud space and send me an email with a link (and a link to this thread)?
Title: Re: iMatch crashes if Win11 restarts while iMatch is running
Post by: ben on April 03, 2024, 08:53:19 PM

QuoteThe DUMP file produced would be interesting. Can you upload it to your cloud space and send me an email with a link (and a link to this thread)?
Of course. Where can I find it?
Title: Re: iMatch crashes if Win11 restarts while iMatch is running
Post by: Mario on April 03, 2024, 09:28:38 PM
See The Debug Dump File (https://www.photools.com/help/imatch/im_dumpfile.htm?dl=hid-1)
Title: Re: iMatch crashes if Win11 restarts while iMatch is running
Post by: ben on April 07, 2024, 11:04:55 AM
I read th
Quote from: Mario on April 03, 2024, 09:28:38 PMSee The Debug Dump File (https://www.photools.com/help/imatch/im_dumpfile.htm?dl=hid-1)
I read the help site. But i only get to see the first dialog. Not the second one "support helper". So i still don't know where the dump file has been stored, if at all.
I check c:\tmp and similar folders but there is no dump file.
Can you reproduce it maybe?
Title: Re: iMatch crashes if Win11 restarts while iMatch is running
Post by: Mario on April 07, 2024, 11:33:01 AM
When Windows terminates IMatch while shutting down, IMatch asking Windows to produce a DUMP file is probably just ignored by Windows, since it is shutting down at the time.

If you run the IMatch log file in debug mode (see log file (https://www.photools.com/help/imatch/#im_logfile.htm)) when this happens, IMatch flushes data to the disk always. Maybe the debug log contains valuable information.

I cannot really reproduce this. Maybe in a VM. 
But I would not get a DUMP file either and I could spend hours or even days without learning anything about why this happened once (?) on one (your) PC...
Title: Re: iMatch crashes if Win11 restarts while iMatch is running
Post by: ben on April 07, 2024, 10:06:30 PM
Quote from: Mario on April 07, 2024, 11:33:01 AMWhen Windows terminates IMatch while shutting down, IMatch asking Windows to produce a DUMP file is probably just ignored by Windows, since it is shutting down at the time.

If you run the IMatch log file in debug mode (see log file (https://www.photools.com/help/imatch/#im_logfile.htm)) when this happens, IMatch flushes data to the disk always. Maybe the debug log contains valuable information.

I cannot really reproduce this. Maybe in a VM.
But I would not get a DUMP file either and I could spend hours or even days without learning anything about why this happened once (?) on one (your) PC...
I don't want to force the crash one more time. I did three times to find a way to reproduce it, now I don't want to stress my database anymore. Then lets just close the bug report
Title: Re: iMatch crashes if Win11 restarts while iMatch is running
Post by: Mario on April 08, 2024, 11:59:43 AM
As long as you have a backup copy of your database (and all your other data of course), nothing bad can happen.

Did you ever experience an IMatch crash when you let your laptop go into sleep or Hibernate?

IMatch processes the WM_QUERYENDSESSION message that Windows sends when it shuts down / reboots.
When a database is open, IMatch rejects the shutdown and provides Windows with the explanation "Database is still open and busy.". Windows should then display this message in the "These applications prevent Windows from restarting" you see in this case. Do you see this message in Windows?

At the same time IMatch responds to this message, it sends itself a WM_CLOSE message - which does the same as you closing IMatch via the X button or <Alt>+<F45>. IMatch then shuts down, closes the database, stops background operations, releases child processes and stuff. IMatch is a database server and it make take a couple of seconds until all background activity is completed.

If Windows loses patience, however, or ignores that IMatch asks to not being closed right now, there is little IMatch can do.
I recommend to close IMatch and all other running applications before rebooting your system.
Title: Re: iMatch crashes if Win11 restarts while iMatch is running
Post by: Mario on April 08, 2024, 02:45:27 PM
So, I've setup a VM (virtual machine) and installed IMatch 2023.8.6

After a few attempts of rebooting Windows while IMatch was running, always pressing Cancel in this dialog:

Image1.jpg

which causes IMatch to shut-down as quickly as possible but allows the user to give it more time, I managed to crash it.
A log in the log file showed that the log file was already closed at the time, which means that IMatch is "almost done" and Windows performs cleanup like unloading DLLs and stuff.

I could not click on the "Create log file yes/no" buttons in the dialog IMatch shows, since it was not responding.
I could, however, create a DUMP file via the Windows Task Manager.

Looking at the DUMP shows that the crash happens in the LIBCEF.DLL, which is part of the Chromium browser used by IMatch. This happens while IMatch is asking Chrome to shut down.

This is outside the control of IMatch or me and can only fixed by Google and the Chromium developers.
I'll close this ticket now.
Title: Re: [NF] iMatch crashes if Win11 restarts while iMatch is running
Post by: ben on April 10, 2024, 09:50:55 PM

QuoteDid you ever experience an IMatch crash when you let your laptop go into sleep or Hibernate?
No, i nearly never had crashes in the past.


QuoteI'll close this ticket now.
Ok that's fine with me, thanks for trying