D4koon / WhatsappTray

Minimize Whatsapp Desktop-Client to Tray
GNU General Public License v3.0
387 stars 32 forks source link

Error at startup (non-blocking) #63

Closed InteXX closed 3 years ago

InteXX commented 3 years ago

I encountered this error at Windows signin today:

image

Here's the relevant log (with line numbers):

 1 03:19:23.771 - WhatsappTray::WinMain() - Starting WhatsappTray 1.5.0.5 in Debug CompileConfiguration.
 2 03:19:23.772 - WhatsAppApi::Init() - Using leveldb-directory:C:\Users\Work\AppData\Roaming\WhatsApp\IndexedDB\file__0.indexeddb.leveldb\
 3 03:19:23.850 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x24'
 4 03:19:23.850 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x81'
 5 03:19:23.852 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x83'
 6 03:19:23.853 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x1'
 7 03:19:23.853 - WhatsappTray::WinMain() - Prepare for starting minimized.
 8 03:19:23.855 - WhatsappTray::StartWhatsapp() - Starting WhatsApp from canonical-path:'C:\Users\Work\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\WhatsApp\WhatsApp.lnk'
 9 03:19:24.066 - WhatsappTray::StartWhatsapp() - Resolved .lnk (Shortcut) to :'C:\Users\Work\AppData\Local\WhatsApp\WhatsApp.exe'
10 03:19:26.904 - WhatsappTray::StartWhatsapp() - WaitForInputIdle failed.
11 03:19:26.919 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x1C'
12 03:19:26.928 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x31F'
13 03:19:28.984 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x1C'
14 03:19:32.941 - WhatsAppApi::IndexedDbChanged() - The logfile has changed
15 03:19:46.846 - WhatsAppApi::IndexedDbChanged() - file.fail()
16 03:19:58.825 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0xC231'
17 03:20:13.525 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x219'
18 03:20:22.685 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0xC230'
19 03:20:23.130 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0xC230'
20 03:20:23.134 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0xC230'
21 03:20:35.335 - WhatsAppApi::IndexedDbChanged() - Found match for receivedMessage.
22 03:21:15.076 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x219'
23 03:21:46.594 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x1C'
24 03:21:53.354 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x1C'
25 03:21:59.876 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0xC2CA'
26 03:22:22.717 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x1C'
27 03:22:25.581 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x1C'
28 03:22:25.770 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x1C'
29 03:22:42.654 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0xC230'
30 03:22:42.657 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0xC230'
31 03:22:43.540 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x1C'
32 03:22:44.899 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x1C'
33 03:22:51.963 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x1C'
34 03:23:02.953 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x3E0'
35 03:23:16.159 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x219'
36 03:24:28.230 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0xC230'
37 03:24:28.235 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0xC230'
38 03:32:12.158 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x1A'
39 03:32:12.361 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x1A'
40 03:32:12.644 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x1A'
41 03:32:12.932 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x1A'
42 03:32:13.236 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x1A'
43 03:51:03.786 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0xC28E'
44 03:51:51.024 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0xC230'
45 03:51:51.027 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0xC230'
46 03:52:57.673 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x1C'
47 03:53:03.755 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x1C'
48 03:56:49.957 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x1C'

With approximately three seconds elapsing between lines 8 & 10, this appears to be an I/O issue. At Windows signin everything is colliding with everything else as they all rush headlong to be first out of the subway station. WAT/WA ran fine after it all settled down. Here's that log:

 1 03:57:07.875 - WhatsappTray::WinMain() - Starting WhatsappTray 1.5.0.5 in Debug CompileConfiguration.
 2 03:57:07.877 - WhatsAppApi::Init() - Using leveldb-directory:C:\Users\Work\AppData\Roaming\WhatsApp\IndexedDB\file__0.indexeddb.leveldb\
 3 03:57:07.882 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x24'
 4 03:57:07.883 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x81'
 5 03:57:07.887 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x83'
 6 03:57:07.888 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x1'
 7 03:57:07.889 - WhatsappTray::WinMain() - Prepare for starting minimized.
 8 03:57:07.890 - WhatsappTray::StartWhatsapp() - Starting WhatsApp from canonical-path:'C:\Users\Work\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\WhatsApp\WhatsApp.lnk'
 9 03:57:07.955 - WhatsappTray::StartWhatsapp() - Resolved .lnk (Shortcut) to :'C:\Users\Work\AppData\Local\WhatsApp\WhatsApp.exe'
10 03:57:08.674 - WhatsappTray::FindWhatsapp() - Filepath is: 'C:\Users\Work\AppData\Local\WhatsApp\app-2.2035.14\WhatsApp.exe'
11 03:57:08.674 - WhatsappTray::FindWhatsapp() - Found match.
12 03:57:08.674 - WhatsappTrayStartWhatsapp() - WhatsApp-Window found.
13 03:57:08.675 - WhatsappTray::SetHook()
14 03:57:08.675 - TrayManager::::ctor() - Creating TrayManger.
15 03:57:08.675 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x31F'
16 03:57:10.007 - WhatsAppApi::IndexedDbChanged() - The logfile has changed
17 03:57:13.445 - WhatsAppApi::IndexedDbChanged() - file.fail()
18 03:57:15.935 - WhatsAppApi::IndexedDbChanged() - Found match for receivedMessage.
19 03:57:15.936 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x407'
20 03:57:15.936 - WhatsappTray::WhatsAppTrayWndProc() - WM_WHATSAPP_API_NEW_MESSAGE
21 03:57:15.939 - WhatsAppApi::IndexedDbChanged() - Found match for receivedMessage.
22 03:57:15.939 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x407'
23 03:57:15.939 - WhatsappTray::WhatsAppTrayWndProc() - WM_WHATSAPP_API_NEW_MESSAGE
24 03:57:15.943 - WhatsAppApi::IndexedDbChanged() - Found match for receivedMessage.
25 03:57:15.943 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x407'
26 03:57:15.943 - WhatsappTray::WhatsAppTrayWndProc() - WM_WHATSAPP_API_NEW_MESSAGE
27 03:57:17.834 - WhatsAppApi::IndexedDbChanged() - Found match for fullInit.
28 03:57:17.834 - WhatsappTray::WinMain() - NotifyOnFullInit
29 03:57:18.774 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x401'
30 03:57:18.774 - WhatsappTray::WhatsAppTrayWndProc() - WM_ADDTRAY
31 03:57:18.774 - TrayManager::MinimizeWindowToTray(0x60F7E)
32 03:57:18.774 - TrayManager::CreateTrayIcon(63)
33 03:57:19.835 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x401'
34 03:57:19.835 - WhatsappTray::WhatsAppTrayWndProc() - WM_ADDTRAY
35 03:57:19.836 - TrayManager::MinimizeWindowToTray(0x60F7E)
36 03:57:19.836 - TrayManager::AddWindowToTray() - Trying to send a window to tray that should already be minimized. This should not happen.
37 03:57:20.279 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x404'
38 03:57:20.299 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x404'
39 03:57:20.389 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x404'
40 03:57:20.405 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x404'
41 03:57:20.429 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x404'
42 03:57:20.523 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x404'
43 03:57:20.555 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x404'
44 03:57:20.561 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x404'
45 03:57:20.569 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x404'
46 03:57:20.577 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x404'
47 03:57:20.593 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x404'
48 03:57:20.780 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x404'
49 03:57:20.797 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x404'
50 03:57:20.905 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x404'
51 03:57:20.914 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x404'
52 03:57:20.914 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x404'
53 03:57:20.914 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x404'
54 03:57:20.914 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x404'
55 03:57:20.933 - TrayManager::RemoveFromTray(63)
56 03:57:21.991 - WhatsAppApi::IndexedDbChanged() - file.fail()
57 03:57:22.889 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x401'
58 03:57:22.889 - WhatsappTray::WhatsAppTrayWndProc() - WM_ADDTRAY
59 03:57:22.890 - TrayManager::MinimizeWindowToTray(0x60F7E)
60 03:57:22.890 - TrayManager::CreateTrayIcon(63)
61 03:58:02.750 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0xC230'
62 03:58:02.755 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0xC230'
63 03:58:45.655 - WhatsAppApi::IndexedDbChanged() - Found match for receivedMessage.
64 03:58:45.655 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0x407'
65 03:58:45.655 - WhatsappTray::WhatsAppTrayWndProc() - WM_WHATSAPP_API_NEW_MESSAGE
66 04:00:31.233 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0xC230'
67 04:00:31.237 - WhatsappTray::WhatsAppTrayWndProc() - Message Received msg='0xC230'

For sure it's not a show-stopper. If anything, it's an extremely minor inconvenience. But if I'm correct, perhaps a bit longer wait for results might mitigate the issue?

malteme commented 3 years ago

I am having this problem too since upgrading to 1.60. Error only occurs when autostarting while windows is booting up. My log looks like this:

16:48:55.073 - WhatsappTray::WinMain(): Starting WhatsappTray 1.6.0.0 in Release CompileConfiguration.
16:48:55.075 - WhatsAppApi::Init() - Using leveldb-directory:C:\Users\malte\AppData\Roaming\WhatsApp\IndexedDB\file__0.indexeddb.leveldb\
16:48:55.080 - WhatsappTray::WinMain() - Prepare for starting minimized.
16:48:55.096 - Hook> Attached hook.dll to ProcessID: 0x00002FF4
16:48:55.096 - Hook> Filepath: 'C:\Program Files (x86)\WhatsappTray\WhatsappTray.exe' WhatsappTrayLoadLibraryTest: 'TRUE'
16:48:55.096 - Hook> Detected that this Attache was triggered by LoadLibrary() => Cancel further processing
16:48:55.109 - WhatsappTray::StartWhatsapp() - Starting WhatsApp from canonical-path:'C:\Users\malte\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\WhatsApp\WhatsApp.lnk'
16:48:55.188 - WhatsappTray::StartWhatsapp() - Resolved .lnk (Shortcut) to:'C:\Users\malte\AppData\Local\WhatsApp\WhatsApp.exe'
16:48:57.841 - WhatsappTray::StartWhatsapp() - WaitForInputIdle failed.
16:49:08.136 - WhatsAppApi::IndexedDbChanged() - The logfile has changed
16:49:08.196 - WhatsAppApi::IndexedDbChanged() - file.fail()
D4koon commented 3 years ago

True i saw the same thing happening. I need to increase the waittime in the line: auto result = WaitForInputIdle(pi.hProcess, 2000);

This will be included in the next version

InteXX commented 3 years ago

@D4koon

Perhaps 3000?

D4koon commented 3 years ago

yes something like that

InteXX commented 3 years ago

@D4koon

At first I imagined it being configurable, but upon some reflection that seemed a bit much. It's not worth the extra effort.

igor-werry commented 3 years ago

my workaround is to kill 'whatsapptray.exe' from task manager, leaving running the 'whatsapp.exe' and starting the 'whatsapptray.exe' again. :)

D4koon commented 3 years ago

Try this version, i increased the timeout from 2 seconds to 8 seconds WhatsappTrayV1.6.2.1.zip

Btw. @igor-werry WhatsappTray should now kill the old instance when restarting it ;)

InteXX commented 3 years ago

@D4koon

The longer timeout seems to be working. Thank you.

WhatsappTray should now kill the old instance when restarting it

Ah, good. That was causing trouble.

D4koon commented 3 years ago

https://github.com/D4koon/WhatsappTray/releases/tag/v1.7.0