canton7 / SyncTrayzor

Windows tray utility / filesystem watcher / launcher for Syncthing
MIT License
5.98k stars 412 forks source link

Crash if two instances started at the same time #354

Open jebeld17 opened 7 years ago

jebeld17 commented 7 years ago

I usually have to wait at least five minutes to start up Synctrayzor + Syncthing on my Windows 10 x64 PC. Otherwise, I get this...

Version: 1.1.15.0; Variant: Installed; Arch: Amd64
Path: C:\Program Files\SyncTrayzor\SyncTrayzor.exe
System.ArgumentNullException: Value cannot be null.
Parameter name: path1
   at System.IO.Path.Combine(String path1, String path2)
   at SyncTrayzor.Pages.UnhandledExceptionViewModel.OpenLogFilePath() in C:\projects\synctrayzor\src\SyncTrayzor\Pages\UnhandledExceptionViewModel.cs:line 54
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Stylet.Xaml.ActionBase.InvokeTargetMethod(Object[] parameters) in c:\projects\stylet\Stylet\Xaml\ActionBase.cs:line 201
   at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated)
   at System.Windows.Documents.Hyperlink.OnClick()
   at System.Windows.Documents.Hyperlink.DoUserInitiatedNavigation(Object sender)
   at System.Windows.Documents.Hyperlink.OnMouseLeftButtonUp(Object sender, MouseButtonEventArgs e)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
   at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.ContentElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
canton7 commented 7 years ago

Interesting - looks like it tried to show the "something went wrong" page, and fell over in the process? Or maybe you clicked the "open log file" link on that page?

Can you find your log file (it will be in C:\Users\<You>\AppData\Roaming\SyncTrayzor\logs\SyncTrayzor.log) and post the last few hundred lines (feel free to obscure device IDs, or just email it to me if you'd rather).

jebeld17 commented 7 years ago

Sorry I didn't get back in time. It happened again...

Version: 1.1.15.0; Variant: Installed; Arch: Amd64
Path: C:\Program Files\SyncTrayzor\SyncTrayzor.exe
System.TimeoutException: The operation has timed out.
   at System.IO.Pipes.NamedPipeClientStream.Connect(Int32 timeout)
   at SyncTrayzor.Services.Ipc.IpcCommsClient.SendCommand(String command) in C:\projects\synctrayzor\src\SyncTrayzor\Services\Ipc\IpcCommsClient.cs:line 53
   at SyncTrayzor.Bootstrapper.Configure() in C:\projects\synctrayzor\src\SyncTrayzor\Bootstrapper.cs:line 123
   at Stylet.BootstrapperBase.Start(String[] args) in c:\projects\stylet\Stylet\BootstrapperBase.cs:line 81
   at System.Windows.Application.OnStartup(StartupEventArgs e)
   at System.Windows.Application.<.ctor>b__1_0(Object unused)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

This is what happens when I try to view the log file from the popup:

Version: 1.1.15.0; Variant: Installed; Arch: Amd64
Path: C:\Program Files\SyncTrayzor\SyncTrayzor.exe
System.ArgumentNullException: Value cannot be null.
Parameter name: path1
   at System.IO.Path.Combine(String path1, String path2)
   at SyncTrayzor.Pages.UnhandledExceptionViewModel.OpenLogFilePath() in C:\projects\synctrayzor\src\SyncTrayzor\Pages\UnhandledExceptionViewModel.cs:line 54
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Stylet.Xaml.ActionBase.InvokeTargetMethod(Object[] parameters) in c:\projects\stylet\Stylet\Xaml\ActionBase.cs:line 201
   at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated)
   at System.Windows.Documents.Hyperlink.OnClick()
   at System.Windows.Documents.Hyperlink.DoUserInitiatedNavigation(Object sender)
   at System.Windows.Documents.Hyperlink.OnMouseLeftButtonUp(Object sender, MouseButtonEventArgs e)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
   at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.ContentElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
canton7 commented 7 years ago

Great, that's enough info for me. Thanks!

jebeld17 commented 7 years ago

I will upload the log file in just a few minutes if I can retrieve it! :-)

jebeld17 commented 7 years ago

Here you go. Thank you for helping me out! Let's hope to get this resolved. SyncTrayzor.log.zip

Here's the clipboard contents from the Windows Problem Details under Reliability History: `Source SyncTrayzor

Summary Stopped working

Date ‎4/‎6/‎2017 9:34 AM

Status Report sent

Description Faulting Application Path: C:\Program Files\SyncTrayzor\SyncTrayzor.exe

Problem signature Problem Event Name: CLR20r3 Problem Signature 01: SyncTrayzor.exe Problem Signature 02: 1.1.15.0 Problem Signature 03: 58dd61e2 Problem Signature 04: System.Core Problem Signature 05: 4.7.2046.0 Problem Signature 06: 589c071f Problem Signature 07: 281 Problem Signature 08: 8b Problem Signature 09: System.TimeoutException OS Version: 10.0.15063.2.0.0.768.101 Locale ID: 1033 Additional Information 1: 95f7 Additional Information 2: 95f77c6f882872b331b9a2be3b52503d Additional Information 3: 3b04 Additional Information 4: 3b047fdcf34e0e3e24cee0381301ecad

Extra information about the problem Bucket ID: 38dc0c97e09ebb71e01cb1ff581a85bb (129408407920) `

Here's an attachment of my Windows Reliability History: WindowsReliabilityHistory.zip

Let me know if there's any other info I can provide.

jebeld17 commented 7 years ago

I tracked down the crash in Event Viewer. I attached all three events related directly to Synctrayzor below.

SyncthingError_EventViewer.zip

Here's the main details from my clipboard: Log Name: Application Source: Application Error Date: 4/6/2017 9:34:02 AM Event ID: 1000 Task Category: (100) Level: Error Keywords: Classic User: N/A Computer: DESKTOP-3RKFFA4 Description: Faulting application name: SyncTrayzor.exe, version: 1.1.15.0, time stamp: 0x58dd61e2 Faulting module name: KERNELBASE.dll, version: 10.0.15063.0, time stamp: 0x461a0ff5 Exception code: 0xe0434352 Fault offset: 0x0000000000069e08 Faulting process id: 0x25ac Faulting application start time: 0x01d2aeda554f9c19 Faulting application path: C:\Program Files\SyncTrayzor\SyncTrayzor.exe Faulting module path: C:\Windows\System32\KERNELBASE.dll Report Id: 2e7d33ef-a2cf-4973-ab39-e2fa1a9eb901 Faulting package full name: Faulting package-relative application ID: Event Xml:

1000 2 100 0x80000000000000 815 Application DESKTOP-3RKFFA4 SyncTrayzor.exe 1.1.15.0 58dd61e2 KERNELBASE.dll 10.0.15063.0 461a0ff5 e0434352 0000000000069e08 25ac 01d2aeda554f9c19 C:\Program Files\SyncTrayzor\SyncTrayzor.exe C:\Windows\System32\KERNELBASE.dll 2e7d33ef-a2cf-4973-ab39-e2fa1a9eb901 Log Name: Application Source: .NET Runtime Date: 4/6/2017 9:33:59 AM Event ID: 1026 Task Category: None Level: Error Keywords: Classic User: N/A Computer: DESKTOP-3RKFFA4 Description: Application: SyncTrayzor.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.TimeoutException at System.IO.Pipes.NamedPipeClientStream.Connect(Int32) at SyncTrayzor.Services.Ipc.IpcCommsClient.SendCommand(System.String) at SyncTrayzor.Bootstrapper.Configure() at Stylet.BootstrapperBase.Start(System.String[]) at System.Windows.Application.OnStartup(System.Windows.StartupEventArgs) at System.Windows.Application.<.ctor>b__1_0(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.DispatcherOperation.InvokeImpl() at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) at MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object) at System.Windows.Threading.DispatcherOperation.Invoke() at System.Windows.Threading.Dispatcher.ProcessQueue() at System.Windows.Threading.Dispatcher.WndProcHook(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) at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef) at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame) at System.Windows.Application.RunDispatcher(System.Object) at System.Windows.Application.RunInternal(System.Windows.Window) at SyncTrayzor.App.Main() Event Xml: 1026 2 0 0x80000000000000 814 Application DESKTOP-3RKFFA4 Application: SyncTrayzor.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.TimeoutException at System.IO.Pipes.NamedPipeClientStream.Connect(Int32) at SyncTrayzor.Services.Ipc.IpcCommsClient.SendCommand(System.String) at SyncTrayzor.Bootstrapper.Configure() at Stylet.BootstrapperBase.Start(System.String[]) at System.Windows.Application.OnStartup(System.Windows.StartupEventArgs) at System.Windows.Application.<.ctor>b__1_0(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.DispatcherOperation.InvokeImpl() at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) at MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object) at System.Windows.Threading.DispatcherOperation.Invoke() at System.Windows.Threading.Dispatcher.ProcessQueue() at System.Windows.Threading.Dispatcher.WndProcHook(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) at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef) at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame) at System.Windows.Application.RunDispatcher(System.Object) at System.Windows.Application.RunInternal(System.Windows.Window) at SyncTrayzor.App.Main() Log Name: Application Source: ESENT Date: 4/6/2017 9:33:33 AM Event ID: 507 Task Category: Performance Level: Warning Keywords: Classic User: N/A Computer: DESKTOP-3RKFFA4 Description: svchost (888) Unistore: A request to read from the file "C:\Users\jebel\AppData\Local\Comms\UnistoreDB\store.vol" at offset 3678208 (0x0000000000382000) for 4096 (0x00001000) bytes succeeded, but took an abnormally long time (15 seconds) to be serviced by the OS. This problem is likely due to faulty hardware. Please contact your hardware vendor for further assistance diagnosing the problem. Event Xml: 507 3 7 0x80000000000000 813 Application DESKTOP-3RKFFA4 svchost 888 Unistore: C:\Users\jebel\AppData\Local\Comms\UnistoreDB\store.vol 3678208 (0x0000000000382000) 4096 (0x00001000) 15
canton7 commented 7 years ago

When it crashes, it looks like you're starting two instances at exactly the same time?

jebeld17 commented 7 years ago

I only have one instance as far as I know. Startup Manager only shows one.

canton7 commented 7 years ago

Yeah:

So I can avoid the crash, and I'll push that shortly. That will result in two instances starting - I can't avoid that until I fix #245.

jebeld17 commented 7 years ago

I just got it to open again after a reinstall of Synctrayzor, but I've done a reinstall recently and what happens is that it opens after reinstall, but crashes again at next login.

canton7 commented 7 years ago

Can you fire up regedit, check HKEY_LOCAL_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run, and see if you've got any entries with an empty value?

canton7 commented 7 years ago

You can grab an intermediate build with the fixes in here: https://ci.appveyor.com/project/canton7/synctrayzor/build/1.1.15.459/artifacts

jebeld17 commented 7 years ago

Do you still want me to check RegEdit? I just got back online.

canton7 commented 7 years ago

Yeah, please.

jebeld17 commented 7 years ago

Okay, problem: This issue is happening again (or something similar to it) in Windows 10 (x64) v1703 "Creators' Edition."

Often times, when the PC is under high stress either due to Syncthing hashing and syncing large files or some other task being done by a separate process - it doesn't seem to need to be ST-related - and Synctrayzor doesn't seem to respond by clicking or right-clicking on the tray icon, the program opens a second instance if I reach to open Synctrayzor through a shortcut or the start menu, leading me to have a similar error because two processes are open at once.

The following below are also true: a) Synctrayzor used to open the window to the original process when I opened the app from shortcuts. b) Synctrayzor would not (by accident or not by accident) allow my PC to run two processes of Syncthing and Synctrayzor at once, ever since the Synctrayzor 1.1.15.159 update.

jebeld17 commented 7 years ago

I apologize about back in April... I forgot to check my system registry :(