cmauri / eviacam

webcam based mouse emulator
GNU General Public License v3.0
143 stars 37 forks source link

eviacam 2.1.2 crashs on Debian 9 #9

Closed chb9 closed 6 years ago

chb9 commented 6 years ago

Hi,

I've issues with eviacam 2.1.2 (master branch) on Debian 9.1 (stable, XFCE).

After using eviacam a few minutes eviacam suddenly crashes with the following errors:

user@debian:~$ eviacamloader
Use: 1000, Group: 1000. Eff. usr: 0, Eff. group: 1000

(eviacam:1395): Gtk-WARNING **: gtk_disable_setlocale() must be called before gtk_init()
HIGHGUI ERROR: V4L: index 1 is not correct!
**
Gdk:ERROR:/build/gtk+2.0-1aCJs4/gtk+2.0-2.24.31/gdk/gdkregion-generic.c:1306:miSubtractNonO1: assertion failed: (y1<y2)
*** Error in `/usr/local/bin/eviacam': malloc(): memory corruption (fast): 0x00007fb70c0a0460 ***
Use: 1000, Group: 1000. Eff. usr: 1000, Eff. group: 1000

user@debian:~$ eviacamloader
Use: 1000, Group: 1000. Eff. usr: 0, Eff. group: 1000

(eviacam:1014): Gtk-WARNING **: gtk_disable_setlocale() must be called before gtk_init()
HIGHGUI ERROR: V4L: index 1 is not correct!
**
Gdk:ERROR:/build/gtk+2.0-1aCJs4/gtk+2.0-2.24.31/gdk/gdkregion-generic.c:1110:miUnionNonO: assertion failed: (y1 < y2)
Use: 1000, Group: 1000. Eff. usr: 1000, Eff. group: 1000
cmauri commented 6 years ago

It looks as if there is some multi-thread issue. I most likely could be related to the "check for updates" feature which spans a secondary thread to do the job. Therefore, first of all make sure you run ./configure script with the "--disable-updates-check" switch. Perhaps you could also remove the wxSocketBase::Initialize(); and wxSocketBase::Shutdown(); calls in eviacamapp.cpp

chb9 commented 6 years ago

Unfortunately the issue occurs also with ./configure --disable-updates-checkand removing the wxSocketBase::Initialize();and wxSocketBase::Shutdown();calls in eviacamapp.cpp.

Sometimes I get another error message: Error in '/usr/local/bin/eviacam': realloc(): invalid next size: 0x000055dea28d0860 ======= Backtrace: ========= /lib/x86_64-linux-gnu/libc.so.6(+0x70bcb)[0x7faf13e92bcb] /lib/x86_64-linux-gnu/libc.so.6(+0x76f96)[0x7faf13e98f96] /lib/x86_64-linux-gnu/libc.so.6(+0x7a10c)[0x7faf13e9c10c] /lib/x86_64-linux-gnu/libc.so.6(realloc+0x159)[0x7faf13e9d6e9] /lib/x86_64-linux-gnu/libglib-2.0.so.0(g_realloc+0x28)[0x7faf127a4ec8] /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0(+0x312f7)[0x7faf166b02f7] /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0(+0x324d5)[0x7faf166b14d5] /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0(gdk_region_union+0x69)[0x7faf166b1bf9] /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0(+0x3d5d0)[0x7faf166bc5d0] /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0(+0x3d746)[0x7faf166bc746] /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0(gtk_widget_queue_draw_area+0x1aa)[0x7faf16b7e01a] /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0(gtk_widget_unparent+0x31d)[0x7faf16b8229d] /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0(+0x80af6)[0x7faf169b4af6] /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0(g_closure_invoke+0x145)[0x7faf12a78f75] /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0(+0x2195c)[0x7faf12a8a95c] /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0(g_signal_emit_valist+0xe3c)[0x7faf12a93bdc] /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0(g_signal_emit+0x8f)[0x7faf12a93fbf] /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0(+0x8bb26)[0x7faf169bfb26] /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0(gtk_button_set_label+0x7e)[0x7faf169c088e] /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0(_ZN14wxToggleButton8SetLabelERK8wxString+0x156)[0x7faf179b0f16] /usr/local/bin/eviacam(+0x75ee7)[0x55dea03d8ee7] /usr/local/bin/eviacam(+0x72e2e)[0x55dea03d5e2e] /usr/local/bin/eviacam(+0xbb208)[0x55dea041e208] /usr/local/bin/eviacam(+0xbdc89)[0x55dea0420c89] /usr/local/bin/eviacam(+0x80c5c)[0x55dea03e3c5c] /usr/local/bin/eviacam(+0xdc287)[0x55dea043f287] /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0(_ZN8wxThread9CallEntryEv+0xa2)[0x7faf1713d012] /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0(+0x1c86a3)[0x7faf171456a3] /lib/x86_64-linux-gnu/libpthread.so.0(+0x7494)[0x7faf16469494] /lib/x86_64-linux-gnu/libc.so.6(clone+0x3f)[0x7faf13f0aaff]

or

Error in '/usr/local/bin/eviacam': double free or corruption (fasttop): 0x00007f1d940e6e50 ======= Backtrace: ========= /lib/x86_64-linux-gnu/libc.so.6(+0x70bcb)[0x7f1dc5490bcb] /lib/x86_64-linux-gnu/libc.so.6(+0x76f96)[0x7f1dc5496f96] /lib/x86_64-linux-gnu/libc.so.6(+0x777de)[0x7f1dc54977de] /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0(gdk_region_intersect+0x72)[0x7f1dc7cafb42] /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0(+0x3e347)[0x7f1dc7cbb347] /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0(gdk_window_process_all_updates+0x118)[0x7f1dc7cbbed8] /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0(+0x3ef39)[0x7f1dc7cbbf39] /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0(+0x1dd37)[0x7f1dc7c9ad37] /lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_dispatch+0x15a)[0x7f1dc3d9d6aa] /lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x4aa60)[0x7f1dc3d9da60] /lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_loop_run+0xc2)[0x7f1dc3d9dd82] /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0(gtk_main+0xb7)[0x7f1dc80613b7] /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0(_ZN14wxGUIEventLoop5DoRunEv+0x25)[0x7f1dc8ee4e65] /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0(_ZN15wxEventLoopBase3RunEv+0x8b)[0x7f1dc862927b] /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0(_ZN16wxAppConsoleBase8MainLoopEv+0x56)[0x7f1dc85ee776] /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0(_Z7wxEntryRiPPw+0x70)[0x7f1dc867acd0] /usr/local/bin/eviacam(+0x64632)[0x5633c7f06632] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf1)[0x7f1dc54402b1] /usr/local/bin/eviacam(+0x6983a)[0x5633c7f0b83a]

or

process finished abnormally. segmentation fault eviacamloader: abnormal process termination, restarting

I've tested eviacam 2.1.2, 2.1.1, 2.1.0, 2.0.1 and 1.7.2 (with added wxWidgets 3.x support).

It occurs if I want to click on something (before the click sound appears). But not on every click.

Thanks for your help.

chb9 commented 6 years ago

I've compiled eViacam 2.1.2 with ./configure --enable-debug and tested with valgrind --leak-check=yes --track-origins=yes --log-file=crash.txt eviacam to find the origin of this issue.

Attached you find the crash.txt.

The "Conditional jump or move depends on uninitialised value(s)" errors are logged at startup. The crash was logged at line 4715.

I hope this information is helpful for you.

cmauri commented 6 years ago

Try the following:

chb9 commented 6 years ago

Disable the option "Allow visual alerts" and check whether it continues crashing when clicking.

eviacam crashes, also if "Beep on click" is disabled.

Disable the DWell Click option completely and check whether it crashes.

eviacam does not crash. It also does not crash with enabled "Enable dwell click" if the "No click" toggle button is activated.

I think it has something to do with the click action, because the issue occurs only after a click. As soon as the click is performed eviacam crashes. (But not after every click.)

I've created a gdb backtrace gdb.txt.

chb9 commented 6 years ago

I found out that eviacam does not crash after a click if the click window is disabled. It crashes only with enabled click window.

cmauri commented 6 years ago

Interesting finding. I bet this happens when the camera thread "touches" the Click Window for update. Specifically, when CClickWindowController::ActionDone is called. In theory, such call is surrounded by wxMutexGuiEnter and wxMutexGuiLeave should be safe (see viacamcontroller.cpp:526 and [1]) but ...

In interesting try would be commenting out the line where ActionDone is called and see what happens.

[1] http://docs.wxwidgets.org/3.0/group__group__funcmacro__thread.html#ga6671c1599fd4ccf6a7c7bb90b2304709

chb9 commented 6 years ago

I think that's the reason.

I've changed Line 147 in dwellclick.cpp to

//m_pClickWindowController->ActionDone(xCurr, yCurr);

and eviacam does not crash after a click with enabled click window.

Thank you!!!

chb9 commented 6 years ago

A better workaround for this issue is to change only Line 320 in clickwindowcontroller.cpp to

//m_pWindow->UpdateButtons(GetEnabled(),GetCurrentButton(), GetLockedButton());

So the click actions will work as expected and only the buttons of the click window are not updated.

cmauri commented 6 years ago

This issue should have been fix in commit a598ace5a8637a8b69bbea19acf21bb05eff5853

chb9 commented 6 years ago

I can confirm that the issue is fixed with this commit.

Thank you!