mzomparelli / zVirtualDesktop

Windows 10 Virtual Desktop Hotkeys, System Tray Icon, Wallpapers, and Task View replacement
458 stars 44 forks source link

Crash on startup #169

Closed jdmcfadden-usx closed 6 years ago

jdmcfadden-usx commented 6 years ago

I've had zVirtualDesktop configured to start on Windows 10 startup from a shortcut in the Startup folder. Most days, this works fine. Occasionally, however, zVD crashes and causes the entire system to freeze up. There will be delays of 8-10 seconds between key press event processing and mouse movement, pretty much rendering the entire Windows UI unresponsive. I typically have to do a hard shutdown and restart in order to recover. Looking at the Event Viewer, I see the following error thrown by the app:

Application: zVirtualDesktop.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.NullReferenceException at zVirtualDesktop.HookHandlers.KeyDown(System.Object, System.Windows.Forms.KeyEventArgs) at zVirtualDesktop.HookManager.KeyboardHookProc(Int32, Int32, IntPtr)

And here's the report from the Windows Error Reporting (the dump files were not to be found.):

Fault bucket 1424331842350634946, type 5 Event Name: CLR20r3 Response: Not available Cab Id: 0

Problem signature: P1: zVirtualDesktop.exe P2: 1.0.0.77 P3: 5a94d763 P4: zVirtualDesktop P5: 1.0.0.77 P6: 5a94d763 P7: 340 P8: b0 P9: System.NullReferenceException P10:

Attached files: minidump.mdmp \?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER415.tmp.WERInternalMetadata.xml \?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER469.tmp.csv \?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER526.tmp.txt

These files may be available here: C:\ProgramData\Microsoft\Windows\WER\ReportArchive\AppCrash_zVirtualDesktop._18f07a5d806a92f24a8eea913511ef51bda5a24_39631286_b193c3e6

Analysis symbol: Rechecking for solution: 0 Report Id: a7e8381b-d74e-49c3-868e-f078467aa735 Report Status: 268435456 Hashed bucket: c64b2233aea4b3da53c43e43a19657c2

mzomparelli commented 6 years ago

Thanks for the info. I think I know what is causing this. The hooks are started before the settings load. So if you press a key before zVD has fully loaded then you will get a NULL reference at zVirtualDesktop.HookHandlers.KeyDown(System.Object, System.Windows.Forms.KeyEventArgs) because that function is looking for the list of hotkeys. I will look into this tonight.

dsp0105 commented 6 years ago

I saw the same issue of crashing at startup on the latest version of zVD. It was resolved by restarting ZVDf

mzomparelli commented 6 years ago

I published an update that should stop this from happening. Aside from adding a Try/Catch which should have been there all along, I also load the settings a lot sooner. The settings will already be loaded by the time you see a system tray icon. I didn't increment the version number. To test this update you'll have to do a "Force Update".

The reason that your mouse froze up from this is because you have the mouse hook enabled. If the program execution slows down then your mouse can show lag because zVD cannot process the mouse events quickly enough. After a few seconds of this the operating system should automatically disconnect the hook. Sometimes it takes a little longer for the OS to forcefully disconnect the hook from the chain. Under normal circumstances you shouldn't see mouse lag. If it becomes an issue then turning off the mouse hook will stop it from occurring.

I'm going to mark this as resolved, but I'll leave it open while I test further.

jdmcfadden-usx commented 6 years ago

Thanks. FWIW: When I experienced the issue, the mouse never recovered, even if I gave the system several minutes. But I did a force update and I'll let you know if I see the problem in the future.

jdmcfadden-usx commented 6 years ago

This is just FYI: this same behavior (frozen or slow keyboard and mouse) occurs if, for some reason, Windows Explorer crashes, presumably because zVD's hooks are now invalid since a new Explorer instance has started.

Here's the pertinent applog stuff:

Entry one Application: zVirtualDesktop.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.Runtime.InteropServices.COMException at WindowsDesktop.Interop.IVirtualDesktopNotificationService.Unregister(UInt32) at WindowsDesktop.VirtualDesktop+<>c__DisplayClass47_0.b0() at WindowsDesktop.Internal.Disposable+AnonymousDisposable.Dispose() at WindowsDesktop.Interop.ComObjects.Initialize() at WindowsDesktop.Interop.ComObjects+<>c.b23_0() at WindowsDesktop.Interop.ComObjects+ExplorerRestartListenerWindow.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) at System.Windows.Interop.HwndSource.PublicHooksFilterMessage(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)

Entry Two Faulting application name: zVirtualDesktop.exe, version: 1.0.0.77, time stamp: 0x5a974c95 Faulting module name: KERNELBASE.dll, version: 10.0.15063.726, time stamp: 0x32774c02 Exception code: 0xe0434352 Fault offset: 0x000ecbb2 Faulting process id: 0x2d20 Faulting application start time: 0x01d3b18da7ed2812 Faulting application path: C:\Users\jmcfadden\Documents\Misc\zVirtualDesktop.exe Faulting module path: C:\WINDOWS\System32\KERNELBASE.dll Report Id: c86343f6-a5e3-40af-a795-e2b42a1d5345 Faulting package full name: Faulting package-relative application

Entry Three Fault bucket 2014869207261149450, type 5 Event Name: CLR20r3 Response: Not available Cab Id: 1366489304399036504

Problem signature: P1: zVirtualDesktop.exe P2: 1.0.0.77 P3: 5a974c95 P4: zVirtualDesktop P5: 1.0.0.77 P6: 5a974c95 P7: 7bd P8: 10 P9: PSZQOADHX1U5ZAHBHOHGHLDGIY4QIXHX P10:

Attached files: \?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER3F3F.tmp.mdmp \?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER4318.tmp.WERInternalMetadata.xml \?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER435A.tmp.csv \?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER438A.tmp.txt \?\C:\Users\jmcfadden\AppData\Local\Temp\WER5039.tmp.appcompat.txt \?\C:\Users\jmcfadden\AppData\Local\Temp\WER57DB.tmp.WERDataCollectionStatus.txt

These files may be available here: C:\ProgramData\Microsoft\Windows\WER\ReportArchive\AppCrash_zVirtualDesktop._689a689b88567996e06f36656edc8940caa51e_7fb50758_cab_43d56d44

Analysis symbol: Rechecking for solution: 0 Report Id: c86343f6-a5e3-40af-a795-e2b42a1d5345 Report Status: 268435464 Hashed bucket: ce6eb5b5201d40239bf640de67ac790a

dsp0105 commented 6 years ago

Hmm..I never see zVD continuing after explorer crash. .When I have an explorer.exe crash(usually when I do Win+D, it is due to the buggy (but useful) program Fences). then I have to restart explorer and then ZVD too.

mzomparelli commented 6 years ago

I'll do some testing on this tonight. Thanks for the feedback.

mzomparelli commented 6 years ago

This time it had nothing to do with the hooks. Instead this is an error from the virtual desktop interface. Providing the stack trace as you did in "Entry One" was very useful. Thank you for knowing how to get this info.

I've published an update that should handle explorer.exe crashing or being killed in task manager. You can get this update now by pressing the Force Update button on the settings form.

You'll see a entry in the zVD log file when this happens. It will look like this...

3/1/2018 17:36 Exception The RPC server is unavailable. (Exception from HRESULT: 0x800706BA) Explorer.exe may have crashed VirtualDesktop VirtualDesktop::b__0() System.Runtime.InteropServices.COMException
mzomparelli commented 6 years ago

Ok, so it looks like the issue still persists. It seems to work ok when not running as an admin, but otherwise it requires restarting zVD. I'll continue to look into this.

jdmcfadden-usx commented 6 years ago

If it can just not freeze everything up after an Explorer crash, I personally think that would be good enough. It wouldn't be unreasonable to expect to restart the app, in my opinion.

mzomparelli commented 6 years ago

It should not cause the program to freeze up anymore. If something else makes zVD crash then it is still susceptible to freezing up due to the mouse hook. If it happens again then please send me the stack trace again.