https://bugs.winehq.org/show_bug.cgi?id=37006
--- Comment #9 from Olivier F. R. Dierick o.dierick@piezo-forte.be --- Issue is still present in wine 1.7.47 (1.7.47-118 actually)
Here is the result of my recent debugging attempt.
The Gecko logfile in APB Reloaded/APBGame/Logs ends with this:
--- gecko logfile --- ... 23:37:39 Controller thread terminated abnormally while waiting for the IO operation to complete. Result = 258 23:37:39 Error = 997 23:37:39 Controller thread stopping 23:37:39 Manager shutting down 23:37:39 Log file closed --- gecko logfile ---
I made a +tid,+relay debug log (split by threads and filtered some functions). The main program and the gecko program communicate through a named pipe.
In the main thread, a named pipe is created.
--- main thread --- ... 0077:Call KERNEL32.CreateNamedPipeW(44f6e030 L"\\.\pipe\apb_gecko_control_109_74",40000003,00000001,00000001,00002000,00002000,00000000,00000000) ret=1107c353 0077:Ret KERNEL32.CreateNamedPipeW() retval=00000108 ret=1107c353 0077:Call KERNEL32.ConnectNamedPipe(00000108,00000000) ret=1107c2f6 0077:Ret KERNEL32.ConnectNamedPipe() retval=00000001 ret=1107c2f6 ... --- main thread ---
The gecko process opens the named pipe.
--- gecko thread --- ... 004b:Call KERNEL32.CreateFileW(0033fca0 L"\\.\pipe\apb_gecko_control_109_74",c0000000,00000000,00000000,00000003,40000000,00000000) ret=004108be 004b:Ret KERNEL32.CreateFileW() retval=00000054 ret=004108be 004b:Call KERNEL32.SetNamedPipeHandleState(00000054,0033fc40,00000000,00000000) ret=004108db 004b:Ret KERNEL32.SetNamedPipeHandleState() retval=00000001 ret=004108db --- gecko thread ---
The main thread then writes to the pipe 5 times like this:
--- main thread --- ... 0077:Call KERNEL32.CreateEventW(00000000,00000001,00000001,00000000) ret=10fe2b46 0077:Ret KERNEL32.CreateEventW() retval=00000114 ret=10fe2b46 0077:Call KERNEL32.WriteFile(00000108,12510c30,0000000b,02a9e6a4,02a9e688) ret=10fe2b79 0077:Ret KERNEL32.WriteFile() retval=00000001 ret=10fe2b79 0077:Call KERNEL32.WaitForSingleObject(00000114,ffffffff) ret=10fe2b95 0077:Ret KERNEL32.WaitForSingleObject() retval=00000000 ret=10fe2b95 0077:Call KERNEL32.CloseHandle(00000114) ret=10fe2ba0 0077:Ret KERNEL32.CloseHandle() retval=00000001 ret=10fe2ba0 ... --- main thread ---
Then a sub-thread of the gecko process reads the pipe successfully.
--- 2nd gecko thread --- ... 004c:Call KERNEL32.SetEvent(00000040) ret=0040bf79 004c:Ret KERNEL32.SetEvent() retval=00000001 ret=0040bf79 004c:Call KERNEL32.ReadFile(00000054,0084ca40,00002000,0084a9fc,0084aa10) ret=0041107d 004c:Ret KERNEL32.ReadFile() retval=00000001 ret=0041107d 004c:Call KERNEL32.GetLastError() ret=00411087 004c:Ret KERNEL32.GetLastError() retval=00000000 ret=00411087 004c:Call KERNEL32.WaitForMultipleObjects(00000002,0084aa08,00000000,00002710) ret=00411145 004c:Ret KERNEL32.WaitForMultipleObjects() retval=00000001 ret=00411145 004c:Call KERNEL32.GetOverlappedResult(00000054,0084aa10,0084a9fc,00000000) ret=0041116e 004c:Ret KERNEL32.GetOverlappedResult() retval=00000001 ret=0041116e 004c:Call KERNEL32.WaitForSingleObject(00000040,000003e8) ret=0040bd72 004c:Ret KERNEL32.WaitForSingleObject() retval=00000000 ret=0040bd72 ... --- 2nd gecko thread ---
After a bunch of operations on configuration files, string loading, writing to the gecko logfile, the 2nd gecko thread tries to read from the pipe again and fails with ERROR_IO_PENDING (000003e5).
--- 2nd gecko thread --- ... 004c:Call KERNEL32.ReadFile(00000054,0084ca40,00002000,0084a9fc,0084aa10) ret=0041107d 004c:Ret KERNEL32.ReadFile() retval=00000000 ret=0041107d 004c:Call KERNEL32.GetLastError() ret=00411087 004c:Ret KERNEL32.GetLastError() retval=000003e5 ret=00411087 004c:Call KERNEL32.WaitForMultipleObjects(00000002,0084aa08,00000000,00002710) ret=00411145 004c:Ret KERNEL32.WaitForMultipleObjects() retval=00000102 ret=00411145 004c:Call KERNEL32.GetLastError() ret=0041124a 004c:Ret KERNEL32.GetLastError() retval=000003e5 ret=0041124a ... --- 2nd gecko thread ---
Afterwards, the main thread fails to write to the pipe with WAIT_TIMEOUT (000000e9). It tries this 4 times then creates another named pipe and deadlocks(?).
--- main thread --- ... 0077:Call KERNEL32.CreateEventW(00000000,00000001,00000001,00000000) ret=10fe2b46 0077:Ret KERNEL32.CreateEventW() retval=000006d8 ret=10fe2b46 0077:Call KERNEL32.WriteFile(00000108,12510c30,00000034,02a9dc98,02a9dc7c) ret=10fe2b79 0077:Ret KERNEL32.WriteFile() retval=00000000 ret=10fe2b79 0077:Call KERNEL32.GetLastError() ret=10fe2b83 0077:Ret KERNEL32.GetLastError() retval=000000e9 ret=10fe2b83 0077:Call KERNEL32.CloseHandle(000006d8) ret=10fe2bcb 0077:Ret KERNEL32.CloseHandle() retval=00000001 ret=10fe2bcb ... 0077:Call KERNEL32.CreateNamedPipeW(02a9da44 L"\\.\pipe\apb_gecko_view_1",40000003,00000001,00000001,00002000,00002000,00000000,00000000) ret=1107c353 0077:Ret KERNEL32.CreateNamedPipeW() retval=00001190 ret=1107c353 0077:Call KERNEL32.ConnectNamedPipe(00001190,00000000) ret=1107c2f6 --- main thread ---