I am trying to make Trillian work under wine. It works fine up to the point where I try to drag its window. Then it hangs and I even need to switch to the text mode shell to be able to kill wine processes. The error says : err:ntdll:RtlpWaitForCriticalSection section 0x40ef98c0 "x11drv_main.c: X11DRV_CritSection" wait timed out in thread 0009, blocked by 000d, retrying (60 sec) Time:973746 Some research showed me that thread 0009 is trying to poll for new window messages while thread 000d is calling GetCursorPos. The GetCursorPos eventually results in a X11 call and it looks like this call never returns.
I built wine from the wine-20031016 sources.
I would appreciate if somebody can give my an insight what might be wrong here or where to look.
Thanks, Nick
Below is the backtrace from winedbg: Thread 0009: =>0 0x401116eb (MSVCRT.DLL.strftime+0x3684b in libc.so.6) (ebp=40850c5c) 1 0x401e227b (NTDLL_wait_for_multiple_objects+0x14f(count=0x0, handles=0x0, flags=0x8, timeout=0x40850d10) [sync.c:1662] in ntdll.dll.so) (ebp=40850cf8) 2 0x401e0b05 (usr1_handler+0x49(__signal=0xa, __context=0x0) [signal_i386.c:1164] in ntdll.dll.so) (ebp=40850d1c) 3 0x400644f8 (MSVCRT.DLL.frexp+0xb98 in libc.so.6) (ebp=40961da8) 4 0x401e227b (NTDLL_wait_for_multiple_objects+0x14f(count=0x1, handles=0x40961e94, flags=0xc, timeout=0x40961eb8) [sync.c:1662] in ntdll.dll.so) (ebp=40961e44) 5 0x401e22f8 (NTDLL.DLL.NtWaitForMultipleObjects+0x50 in ntdll.dll.so) (ebp=40961e6c) 6 0x401e232d (NtWaitForSingleObject+0x25(handle=0x88, alertable=0x0, timeout=0x40961eb8) [sync.c:616] in ntdll.dll.so) (ebp=40961e8c) 7 0x401c942e (RtlpWaitForCriticalSection+0xfe(crit=0x40ef98c0) [critsection.c:197] in ntdll.dll.so) (ebp=40961f20) 8 0x401c963b (RtlEnterCriticalSection+0x77(crit=0x40ef98c0) [critsection.c:1664] in ntdll.dll.so) (ebp=40961f40) 9 0x40edd5ff (wine_tsx11_lock+0x4f [x11drv_main.c:167] in x11drv.dll.so) (ebp=40961f68) 10 0x40eceb9d (process_events+0x21(data=0x40321ea0) [event.c:153] in x11drv.dll.so) (ebp=40961fe0) 11 0x40ececf2 (X11DRV_MsgWaitForMultipleObjectsEx+0xfe(count=0x1, handles=0x4036250c, timeout=0xffffffff, mask=0x0, flags=0x0) [event.c:195] in x11drv.dll.so) (ebp=40962108) 12 0x40a42509 (GetMessageW+0x195(msg=0x40962288, hwnd=0x0, first=0x100, last=0x20d) [message.c:2363] in user32.dll.so) (ebp=409621b4) 13 0x40edc332 (X11DRV_SysCommandSizeMove+0x3ba(hwnd=0x1002e, wParam=0xf012) [winpos.c:2005] in x11drv.dll.so) (ebp=409622b4) 14 0x40a19c0c (NC_HandleSysCommand+0xb0(hwnd=0x1002e, wParam=0xf012, lParam=0xb0374) [nonclient.c:2152] in user32.dll.so) (ebp=409622e0) 15 0x40a0a70c (DEFWND_DefWinProc+0x834(hwnd=0x1002e, msg=0x112, wParam=0xf012, lParam=0xb0374) [defwnd.c:534] in user32.dll.so) (ebp=40962374) 16 0x40a0abd0 (DefWindowProcA+0x94(hwnd=0x1002e, msg=0x112, wParam=0xf012, lParam=0xb0374) [defwnd.c:863] in user32.dll.so) (ebp=409623a0) 17 0x1001d744 (TOOLKIT.DLL.getMinorVersion+0x1ca4 in TOOLKIT.DLL) (ebp=40a28474) 18 0x0c75ff02 (trillian.exe..rsrc+0xc32bf02) (ebp=6ae58955)
Thread 000d: =>0 0x401116eb (MSVCRT.DLL.strftime+0x3684b in libc.so.6) (ebp=42750c5c) 1 0x401e227b (NTDLL_wait_for_multiple_objects+0x14f(count=0x0, handles=0x0, flags=0x8, timeout=0x42750d10) [sync.c:1662] in ntdll.dll.so) (ebp=42750cf8) 2 0x401e0b05 (usr1_handler+0x49(__signal=0xa, __context=0x0) [signal_i386.c:1164] in ntdll.dll.so) (ebp=42750d1c) 3 0x400644f8 (MSVCRT.DLL.frexp+0xb98 in libc.so.6) (ebp=42872190) 4 0x40f53a07 (_end+0x59037 in libX11.so.6) (ebp=428721c0) 5 0x40f5454d (_end+0x59b7d in libX11.so.6) (ebp=42872200) 6 0x40f4a36b (_end+0x4f99b in libX11.so.6) (ebp=42872240) 7 0x40ed6162 (TSXQueryPointer+0x36(a0=0x3c089440, a1=0x93, a2=0x428722a0, a3=0x428722a4, a4=0x428722a8, a5=0x428722ac, a6=0x428722b0, a7=0x428722b4, a8=0x428722b8) [ts_xlib.c:480] in x11drv.dll.so) (ebp=42872274) 8 0x40ed3ede (X11DRV_GetCursorPos+0x56(pos=0x42872314) [mouse.c:529] in x11drv.dll.so) (ebp=428722c4) 9 0x40a0f5d7 (GetCursorPos+0x47(pt=0x42872314) [input.c:479] in user32.dll.so) (ebp=428722d4) 10 0x4186d288 (EVENTS.DLL.setSkin+0x48 in EVENTS.DLL) (ebp=00000000)
Small exerpt from the custom trace I used. trace:vasya:wine_tsx11_unlock 0009:*** BEFORE LEAVE CR.SEC. Time: 951825 trace:vasya:RtlLeaveCriticalSection LeaveCRS:0009 name:0x40ef98c0 "x11drv_main.c: X11DRV_CritSection" trace:vasya:wine_tsx11_unlock 0009:*** AFTER LEAVE CR.SEC. Time: 951836 trace:vasya:X11DRV_MsgWaitForMultipleObjectsEx 0009:Before WaitForM... Timeout:ffffffff trace:vasya:NTDLL_wait_for_multiple_objects 0009: WFMO - BEGIN trace:vasya:wine_tsx11_lock 000d:*** BEFORE ENTER CR.SEC. Time: 953724 Onwer:0000 Recurs:0 trace:vasya:RtlEnterCriticalSection EnterCRS:000d name: 0x40ef98c0 "x11drv_main.c: X11DRV_CritSection" trace:vasya:wine_tsx11_lock 000d:*** AFTER ENTER CR.SEC. Time: 953736 trace:vasya:NTDLL_wait_for_multiple_objects 0009: WFMO - END. ret=0001 trace:vasya:wine_tsx11_lock 0009:*** BEFORE ENTER CR.SEC. Time: 958696 Onwer:000d Recurs:1 trace:vasya:RtlEnterCriticalSection EnterCRS:0009 name: 0x40ef98c0 "x11drv_main.c: X11DRV_CritSection" trace:vasya:NTDLL_wait_for_multiple_objects 0009: WFMO - BEGIN trace:vasya:NTDLL_wait_for_multiple_objects 0009: WFMO - END. ret=0102 err:ntdll:RtlpWaitForCriticalSection section 0x40ef98c0 "x11drv_main.c: X11DRV_CritSection" wait timed out in thread 0009, blocked by 000d, retrying (60 sec) Time:973746
I think this is caused by Wine doing an XLock then not releasing it for whatever reason - I guess the signal handler being called in the second backtrace indicates a crash or something. Have you tried doing a +seh trace?
The +seh does not add anything to the log. Actually I thought that I failed to turn it on until the application crashed for another reason and then I found something with seh in the log... The handler called is /********************************************************************** * usr1_handler * * Handler for SIGUSR1, used to signal a thread that it got suspended. */
static HANDLER_DEF(usr1_handler) { LARGE_INTEGER timeout; ..... skipped a couple of lines NTDLL_wait_for_multiple_objects( 0, NULL, 0, &timeout ); }
It is called AFTER the 5-seconds timeout has expired. Also it is called for every thread of the application - not just for these two. It makes me think that is the result of the problem rather than its cause.
Any ideas why a call to the XQueryPointer function may fail to return in 5 seconds? The whole X system freezes until I kill wine processes from a text shell.
Thanks, Nick
Mike Hearn wrote:
I think this is caused by Wine doing an XLock then not releasing it for whatever reason - I guess the signal handler being called in the second backtrace indicates a crash or something. Have you tried doing a +seh trace?
Nick Sukharev nik@galantis.com writes:
Any ideas why a call to the XQueryPointer function may fail to return in 5 seconds? The whole X system freezes until I kill wine processes from a text shell.
SIGUSR1 means the thread has been suspended. Of course if it gets suspended while holding the X11 lock it can cause problems... you should probably try to find out who is suspending that thread.