Andreas Mohr wrote:
On Sun, Oct 20, 2002 at 08:27:00AM +0200, Till Mossakowski wrote:
P.S.
I should be more precise: P1 and P2 are different Wine *threads* (and Linux processes). Shouldn't all threads use the *same* X11 lock, such that only one thread at a time can have the X11 lock?
Well, err... yes. That's exactly what we do. We clone() (on Linux) the current Wine process for a new thread (thus we get *two* Wine processes). And due to clone()ing, the second process shares the process environment of the first process (almost) completely. Thus the X11 lock variable is the same. (otherwise a "lock" wouldn't be a "lock" and wouldn't make a whole lot of sense ;-))
OK, this perfectly agrees with my understanding of what a lock is. But I have got the impression that two processes can simultaneously get the X11 lock, and that this is the crux of the problem. To become sure, I have added some tracing in dlls/x11drv/x11drv_main.c:
void wine_tsx11_lock(void) { EnterCriticalSection( &X11DRV_CritSection ); TRACE_(x11drv)("critical section entered.\n"); }
void wine_tsx11_unlock(void) { TRACE_(x11drv)("going to leave critical section.\n"); LeaveCriticalSection( &X11DRV_CritSection ); }
Now when looking at the part of the relay trace just before the program hangs, you can see that there are two consecutive locks without an unlock in between (look at the last 4 lines of the relay trace below, but also before the same thing happens). Is this possibly related to the problem that the last PeekMessageA (as well as the WaitMessage 9 lines above) do not return?
What we need is backtraces of *all* wine processes that are involved in the deadlock.
gdb wine attach <Wine PID> bt detach attach <next Wine PID> bt detach ...
That way we'll hopefully be able to figure out why the processes are getting stuck.
I have appended all what I could get to my previous message. Using attach/detach, I could only backtrace two of the processes. For the other ones, I got
(gdb) attach 17463 Attaching to program: /usr/local/bin/wine, process 17463 ptrace: Operation not permitted. (gdb) a
Only after killing the first two processes, I could attach the other ones (step by step), and then make a bt. The output is contained in my previous message.
Many thanks for your help, Till
----------------------------------------------------------------- the relay trace, generated with
wine --debugmsg +relay,warn+all,+x11drv,+win32,+x11 /usr/local/LPL/LPL\ Software/Fitch\ Folder/FITCH.EXE 2>&1|egrep "x11_lock|x11_unlock|WaitMessage|PeekMessage"
080b9c90:Call user32.PeekMessageA(48c12c88,00000000,00000000,00000000,00000001) ret=180177b6 trace:x11drv:wine_tsx11_lock critical section entered. trace:x11drv:wine_tsx11_unlock going to leave critical section. trace:x11drv:wine_tsx11_lock critical section entered. trace:x11drv:wine_tsx11_unlock going to leave critical section. 080b9c90:Ret user32.PeekMessageA() retval=00000000 ret=180177b6 080b9c90:Call user32.WaitMessage() ret=1801776a 08074060:Ret user32.PeekMessageA() retval=00000000 ret=004072c9 trace:x11drv:wine_tsx11_lock critical section entered. trace:x11drv:wine_tsx11_unlock going to leave critical section. trace:x11drv:wine_tsx11_lock critical section entered. trace:x11drv:wine_tsx11_unlock going to leave critical section. trace:x11drv:wine_tsx11_lock critical section entered. trace:x11drv:wine_tsx11_unlock going to leave critical section. trace:x11drv:wine_tsx11_lock critical section entered. trace:x11drv:wine_tsx11_unlock going to leave critical section. trace:x11drv:wine_tsx11_lock critical section entered. trace:x11drv:wine_tsx11_lock critical section entered. trace:x11drv:wine_tsx11_unlock going to leave critical section. 08074060:Call user32.PeekMessageA(406e2668,00000000,00000000,00000000,00000000) ret=004072c9 trace:x11drv:wine_tsx11_unlock going to leave critical section. trace:x11drv:wine_tsx11_lock critical section entered. trace:x11drv:wine_tsx11_unlock going to leave critical section. trace:x11drv:wine_tsx11_lock critical section entered. trace:x11drv:wine_tsx11_unlock going to leave critical section. trace:x11drv:wine_tsx11_lock critical section entered. trace:x11drv:wine_tsx11_unlock going to leave critical section. 080b9c90:Ret user32.WaitMessage() retval=00000001 ret=1801776a 080b9c90:Call user32.PeekMessageA(48c12c88,00000000,00000000,00000000,00000001) ret=180177b6 trace:x11drv:wine_tsx11_lock critical section entered. trace:x11drv:wine_tsx11_unlock going to leave critical section. trace:x11drv:wine_tsx11_lock critical section entered. trace:x11drv:wine_tsx11_unlock going to leave critical section. trace:x11drv:wine_tsx11_lock critical section entered. trace:x11drv:wine_tsx11_unlock going to leave critical section. 080b9c90:Ret user32.PeekMessageA() retval=00000000 ret=180177b6 080b9c90:Call user32.WaitMessage() ret=1801776a 08074060:Ret user32.PeekMessageA() retval=00000000 ret=004072c9 trace:x11drv:wine_tsx11_lock critical section entered. trace:x11drv:wine_tsx11_unlock going to leave critical section. trace:x11drv:wine_tsx11_lock critical section entered. trace:x11drv:wine_tsx11_unlock going to leave critical section. trace:x11drv:wine_tsx11_lock critical section entered. trace:x11drv:wine_tsx11_lock critical section entered. trace:x11drv:wine_tsx11_unlock going to leave critical section. 08074060:Call user32.PeekMessageA(406e2668,00000000,00000000,00000000,00000000) ret=004072c9