http://bugs.winehq.org/show_bug.cgi?id=24185
Summary: Deadlock in vectored exception handling Product: Wine Version: 1.3.0 Platform: x86 OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: ntdll AssignedTo: wine-bugs@winehq.org ReportedBy: krissn@op.pl
When running MapSource (a Garmin GPS map manager) I noticed that the application will hang soon after starting. The hang occurs at random time when MapSource is drawing the map on the screen. The log output clearly indicates a classic deadlock:
err:ntdll:RtlpWaitForCriticalSection section 0x7efec6e0 "/var/tmp/portage/app-emulation/wine-1.3.0/work/wine-1.3.0/dlls/ntdll/exception.c: vectored_handlers_section" wait timed out in thread 001b, blocked by 0009, retrying (60 sec) err:ntdll:RtlpWaitForCriticalSection section 0x7e9f3d80 "/var/tmp/portage/app-emulation/wine-1.3.0/work/wine-1.3.0/dlls/gdi32/gdiobj.c: gdi_section" wait timed out in thread 0009, blocked by 001b, retrying (60 sec)
Some deeper investigation revealed that the GDI's DIB exception handler is involved in this problem. Here's the scenario:
1. Thread A calls a GDI function. The function takes the "gdi_section". 2. Thread B raises an exception (could be a C++ exception). The call_vectored_handlers() function is called to call the handlers. The "vectored_handlers_section" is entered. 3. Thread B execues the X11DRV_DIB_FaultHandler(), which eventually leads to a call to GetObjectW() and in turn GDI_GetObjPtr(). The last one blocks on "gdi_section". 4. Thread A throws an Access Violation exception in the DIB functions. The call_vectored_handlers() function is called, but this time it blocks on "vectored_handlers_section"
A possible solution would be to replace the "vectored_handlers_section" by a RW lock. This would ensure that multiple exception handlers are called simultaneously while still maintaining consistency in case the vectored exception handler list needs to be changed.
http://bugs.winehq.org/show_bug.cgi?id=24185
--- Comment #1 from Krzysztof Nowicki krissn@op.pl 2010-08-28 11:20:34 CDT --- Created an attachment (id=30447) --> (http://bugs.winehq.org/attachment.cgi?id=30447) 0001-Replace-critical-section-with-an-rw-lock.patch
Patch implementing read-write locks in vectored exception handling
http://bugs.winehq.org/show_bug.cgi?id=24185
Vincent Povirk madewokherd@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch
--- Comment #2 from Vincent Povirk madewokherd@gmail.com 2010-09-16 15:53:29 CDT --- Thanks for the great analysis and patch. Unfortunately, my lack of familiarity with exception handling code means I can't give the patch a proper review, and it's not likely to get much attention on bugzilla.
You should send patches to wine-patches@winehq.org, so the Wine maintainer can review them.
Please see the patch submission guidelines here: http://wiki.winehq.org/SubmittingPatches
http://bugs.winehq.org/show_bug.cgi?id=24185
Krzysztof Nowicki krissn@op.pl changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |FIXED
--- Comment #3 from Krzysztof Nowicki krissn@op.pl 2010-10-12 12:54:31 CDT --- Patch has been commited to git repo.
http://source.winehq.org/git/wine.git/?a=commit;h=eb0e82a75568db095df5f78be7...
http://bugs.winehq.org/show_bug.cgi?id=24185
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #4 from Alexandre Julliard julliard@winehq.org 2010-10-15 12:50:48 CDT --- Closing bugs fixed in 1.3.5.