[NF] iMatch crashes if Win11 restarts while iMatch is running

Started by ben, April 02, 2024, 10:14:52 PM

Previous topic - Next topic

ben

Problem:
iMatch crashes and (tries) to write a dump file, if Win11 gets restarted while iMatch is running.

Reproduce it:
  • Open iMatch
  • Open another application that will force windows to pause a restart, e.g. open an excel document, make changes to it but don't save it 
  • Restart Win11 
    -> This will show a Win11 full screen window that tells you to close all open applications. You should see at least iMatch and Excel.
  • Click abort -> you'll see an excel modal window that asks if you want to save the document. And iMatch will show a dialog "iMatch has encountered a problem and needs to close. [..] iMatch will now write a memory dump [..]"

Comments:
  • I think this didn't happen when using Win10
  • Of course, one should close iMatch before restarting windows, i just forgot about it
  • Opening excel is only needed to force windows to not restart. If only iMatch is still open, Windows will forcefully kill it and restart anyways

Ben

Mario

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

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)?
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

ben


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?

Mario

-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

ben

I read th
Quote from: Mario on April 03, 2024, 09:28:38 PMSee The Debug Dump File
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?

Mario

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) 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...
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

ben

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) 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

Mario

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.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Mario

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.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

ben


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