https://bugs.winehq.org/show_bug.cgi?id=44255
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |focht@gmx.net Component|-unknown |quartz URL| |http://www.moddb.com/engine | |s/wolf-rpg-editor/downloads | |/wolf-rpg-editor-english-v2 | |10b-sample-game Keywords| |download Status|UNCONFIRMED |NEW Ever confirmed|0 |1
--- Comment #3 from Anastasius Focht focht@gmx.net --- Hello folks,
confirming.
I found an example game to reproduce here:
http://www.moddb.com/engines/wolf-rpg-editor/downloads/wolf-rpg-editor-engli...
--- snip --- $ WINEDEBUG=+seh,+loaddll,+quartz wine ./Game.exe ... 0009:trace:loaddll:load_native_dll Loaded L"Z:\home\focht\Downloads\WRPGE Eng v2.10B Sample Game\GuruGuruSMF4.dll" at 0x10000000: native 0009:trace:loaddll:load_builtin_dll Loaded L"C:\windows\system32\dsound.dll" at 0x7c0c0000: builtin 0009:trace:loaddll:load_builtin_dll Loaded L"C:\windows\system32\dmusic.dll" at 0x7ca60000: builtin 0009:trace:loaddll:load_builtin_dll Loaded L"C:\windows\system32\winealsa.drv" at 0x7ca30000: builtin 0009:trace:loaddll:load_builtin_dll Loaded L"C:\windows\system32\msacm32.drv" at 0x7ca10000: builtin 0009:trace:loaddll:load_builtin_dll Loaded L"C:\windows\system32\midimap.dll" at 0x7c7b0000: builtin 0009:err:winediag:MIDIMAP_drvOpen No software synthesizer midi port found, Midi sound output probably won't work. 0009:trace:loaddll:load_builtin_dll Loaded L"C:\windows\system32\dmsynth.dll" at 0x7c430000: builtin 0009:trace:loaddll:load_builtin_dll Loaded L"C:\windows\system32\msvfw32.dll" at 0x7c090000: builtin 0009:trace:loaddll:load_builtin_dll Loaded L"C:\windows\system32\quartz.dll" at 0x76970000: builtin 0009:trace:quartz:DllGetClassObject ({e436ebb1-524f-11ce-9f53-0020af0ba770},{00000001-0000-0000-c000-000000000046},0x3372d8) 0009:trace:quartz:DSCF_CreateInstance (0x40910d8)->((nil),{56a86897-0ad4-11ce-b03a-0020af0ba770},0x3372dc) 0009:trace:quartz:QUARTZ_CreateSystemClock (0x33727c,(nil)) 0009:trace:quartz:SystemClockImpl_QueryInterface (0x208ca0, {56a86897-0ad4-11ce-b03a-0020af0ba770},0x33727c) 0009:trace:quartz:SystemClockImpl_AddRef (0x208ca0): AddRef from 0 0009:trace:quartz:SystemClockImpl_QueryInterface (0x208ca0, {56a86897-0ad4-11ce-b03a-0020af0ba770},0x3372dc) 0009:trace:quartz:SystemClockImpl_AddRef (0x208ca0): AddRef from 1 0009:trace:quartz:SystemClockImpl_Release (0x208ca0): ReleaseRef to 1 0009:fixme:dmsynth:IDirectMusicSynth8Impl_SetMasterClock (0x4090ea8)->(0x208ae0): stub 0009:fixme:dmsynth:IDirectMusicSynthSinkImpl_SetMasterClock (0x208c18)->(0x208ae0): stub 0009:trace:quartz:SystemClockImpl_AddRef (0x208ca0): AddRef from 1 0009:fixme:dmsynth:IDirectMusicSynth8Impl_Open (0x4090ea8)->(0x3377a8): stub 0009:fixme:dmusic:synth_dmport_Activate (0x4090cd0/0x4090cd0)->(1): semi-stub 0009:trace:loaddll:load_builtin_dll Loaded L"C:\windows\system32\dmloader.dll" at 0x7c050000: builtin 0009:err:dmloader:IDirectMusicLoaderImpl_SetObject : could not attach stream to file L"C:\windows\system32\drivers\gm.dls", make sure it exists 0009:fixme:dmloader:IDirectMusicLoaderImpl_GetObject : unknown/unsupported way of loading ... 0009:trace:loaddll:free_modref Unloaded module L"C:\windows\system32\d3d9.dll" : builtin 0009:trace:loaddll:free_modref Unloaded module L"C:\windows\system32\xinput1_4.dll" : builtin AL lib: (WW) ReleaseContext: 0x7c75c9c0 released while current on thread AL lib: (WW) ReleaseThreadCtx: 0x7c75c9c0 current for thread being destroyed 0009:trace:loaddll:free_modref Unloaded module L"C:\windows\system32\xaudio2_8.dll" : builtin 0009:fixme:win:WINNLSEnableIME hwnd 0x10056 enable 1: stub! 0009:trace:loaddll:free_modref Unloaded module L"C:\windows\system32\dwmapi.dll" : builtin 0009:fixme:dmusic:synth_dmport_Activate (0x4090cd0/0x4090cd0)->(0): semi-stub 0009:fixme:dmsynth:IDirectMusicSynth8Impl_Close (0x4090ea8)->(): stub 0009:trace:quartz:SystemClockImpl_Release (0x208ca0): ReleaseRef to 1 0009:trace:quartz:SystemClockImpl_Release (0x208ca0): ReleaseRef to 0 0053:err:ntdll:RtlpWaitForCriticalSection section 0x7bcf675c "/home/focht/projects/wine/wine.repo/src/dlls/ntdll/loader.c: loader_section" wait timed out in thread 0053, blocked by 0009, retrying (60 sec) --- snip ---
Dumping callstacks for relevant threads:
--- snip --- Wine-dbg>info process pid threads executable (all id:s are in hex) 00000027 4 'explorer.exe' 0000000e 5 'services.exe' 00000020 3 _ 'winedevice.exe' 0000001a 3 _ 'plugplay.exe' 00000011 4 _ 'winedevice.exe' 00000008 6 'Game.exe'
Wine-dbg>attach 0x8
Wine-dbg>info thread process tid prio (all id:s are in hex) 00000008 (D) Z:\home\focht\Downloads\WRPGE Eng v2.10B Sample Game\Game.exe 00000053 15 00000052 15 00000051 0 0000004f 15 0000004d 0 00000009 0 <==
Wine-dbg>bt 0x9 Backtrace: =>0 0xf7705be9 __kernel_vsyscall+0x9() in [vdso].so (0x00337888) 1 0xf74ebedf pthread_sigmask+0x3e() in libpthread.so.0 (0x00337888) 2 0x7bc8c5f4 wine_server_call+0x45(req_ptr=0x3378a8) [/home/focht/projects/wine/wine.repo/src/dlls/ntdll/server.c:322] in ntdll (0x00337888) 3 0x7eb94a5b put_message_in_queue+0x2fc(info=0x337a10, reply_size=0x0(nil)) [/home/focht/projects/wine/wine.repo/src/dlls/user32/message.c:3131] in user32 (0x003379f8) 4 0x7eb95adb PostThreadMessageW+0x8e(thread=<couldn't compute location>, msg=<couldn't compute location>, wparam=<couldn't compute location>, lparam=<couldn't compute location>) [/home/focht/projects/wine/wine.repo/src/dlls/user32/message.c:3701] in user32 (0x00337a48) 5 0x7684da12 SystemClockPostMessageToAdviseThread+0x7d(This=0x4090c88, iMsg=0x8000) [/home/focht/projects/wine/wine.repo/src/dlls/quartz/systemclock.c:190] in quartz (0x00337a88) 6 0x7684dcc1 SystemClockImpl_Release+0xa2(iface=<couldn't compute location>) [/home/focht/projects/wine/wine.repo/src/dlls/quartz/systemclock.c:232] in quartz (0x00337ac8) 7 0x7c01e3ff IDirectMusicSynthSinkImpl_Release+0xb3(iface=<couldn't compute location>) [/home/focht/projects/wine/wine.repo/src/dlls/dmsynth/synthsink.c:82] in dmsynth (0x00337b28) 8 0x7c0ed8d0 SynthPortImpl_IDirectMusicPort_Release+0x112(iface=<couldn't compute location>) [/home/focht/projects/wine/wine.repo/src/dlls/dmusic/port.c:201] in dmusic (0x00337b88)
Wine-dbg>bt 0x4f Backtrace: =>0 0xf7705be9 __kernel_vsyscall+0x9() in [vdso].so (0x0387fde8) 1 0xf73ff04b __GI___poll+0x4a() in libc.so.6 (0x0387fde8) 2 0x7d9f19d0 pulse_poll_func+0x26(ufds=0x7d200510, nfds=0x2, timeout=0xa, userdata=0x0(nil)) [/home/focht/projects/wine/wine.repo/src/dlls/winepulse.drv/mmdevdrv.c:270] in winepulse (0x0387fde8) 3 0x7d98483b pa_mainloop_poll+0xca() in libpulse.so.0 (0x7d9f19a9) 4 0x7d9850b1 pa_mainloop_iterate+0x40() in libpulse.so.0 (0x0387fed8) 5 0x7d985184 pa_mainloop_run+0x33() in libpulse.so.0 (0x0387fed8) 6 0x7d9f1a50 pulse_mainloop_thread+0x64(tmp=<couldn't compute location>) [/home/focht/projects/wine/wine.repo/src/dlls/winepulse.drv/mmdevdrv.c:281] in winepulse (0x0387fed8) 7 0x7bc9334c call_thread_func_wrapper+0xb() in ntdll (0x0387feec) 8 0x7bc933b2 call_thread_func+0x63(entry=0x7d9f19eb, arg=0x0(nil)) [/home/focht/projects/wine/wine.repo/src/dlls/ntdll/signal_i386.c:2944] in ntdll (0x0387ffdc) 9 0x7bc9333e call_thread_entry+0x9() in ntdll (0x0387ffec)
Wine-dbg>bt 0x52 Backtrace: =>0 0xf7705be7 __kernel_vsyscall+0x7() in [vdso].so (0x0446fa48) 1 0xf74ee31b __libc_read+0x4a() in libpthread.so.0 (0x0446fa48) 2 0x7bc8c66e wait_select_reply+0x1c(cookie=0x446fb2c) [/home/focht/projects/wine/wine.repo/src/dlls/ntdll/server.c:359] in ntdll (0x0446fa48) 3 0x7bc8d2ee server_select+0x163(select_op=0x446fb84, size=0x8, flags=0x2, timeout=0x446fd18) [/home/focht/projects/wine/wine.repo/src/dlls/ntdll/server.c:618] in ntdll (0x0446fb58) 4 0x7bc97c73 wait_objects+0xb6(count=0x1, handles=0x446fd20, wait_any=1, alertable=0, timeout=0x446fd18) [/home/focht/projects/wine/wine.repo/src/dlls/ntdll/sync.c:1031] in ntdll (0x0446fc98) 5 0x7bc97cb1 NtWaitForMultipleObjects+0x38(count=<couldn't compute location>, handles=<couldn't compute location>, wait_any=1, alertable=0, timeout=<couldn't compute location>) [/home/focht/projects/wine/wine.repo/src/dlls/ntdll/sync.c:1042] in ntdll (0x0446fcd8) 6 0x7b47d03d WaitForMultipleObjectsEx+0xad(count=<couldn't compute location>, handles=<couldn't compute location>, wait_all=<couldn't compute location>, timeout=<couldn't compute location>, alertable=<couldn't compute location>) [/home/focht/projects/wine/wine.repo/src/dlls/kernel32/sync.c:189] in kernel32 (0x0446fe38) 7 0x7b47cebf WaitForSingleObject+0x24(handle=<couldn't compute location>, timeout=<couldn't compute location>) [/home/focht/projects/wine/wine.repo/src/dlls/kernel32/sync.c:128] in kernel32 (0x0446fe78) 8 0x7c0a5d6f DSOUND_mixthread+0x77(p=<couldn't compute location>) [/home/focht/projects/wine/wine.repo/src/dlls/dsound/mixer.c:756] in dsound (0x0446fed8) 9 0x7bc9334c call_thread_func_wrapper+0xb() in ntdll (0x0446feec) 10 0x7bc933b2 call_thread_func+0x63(entry=0x7c0a5cf7, arg=0x40906d0) [/home/focht/projects/wine/wine.repo/src/dlls/ntdll/signal_i386.c:2944] in ntdll (0x0446ffdc) 11 0x7bc9333e call_thread_entry+0x9() in ntdll (0x0446ffec)
Wine-dbg>bt 0x53 Backtrace: =>0 0xf7705be9 __kernel_vsyscall+0x9() in [vdso].so (0x00000000) 1 0xf7405d47 syscall+0x26() in libc.so.6 (0x00000000) 2 0x7bc4c252 futex_wait+0x25(addr=0x7bcf676c, val=0, timeout=0x134ea04) [/home/focht/projects/wine/wine.repo/src/dlls/ntdll/critsection.c:69] in ntdll (0x0134e9e8) 3 0x7bc4c330 fast_wait+0x3a(crit=0x7bcf675c, timeout=0x3c) [/home/focht/projects/wine/wine.repo/src/dlls/ntdll/critsection.c:108] in ntdll (0x0134ea18) 4 0x7bc4c46a wait_semaphore+0x20(crit=0x7bcf675c, timeout=0x3c) [/home/focht/projects/wine/wine.repo/src/dlls/ntdll/critsection.c:229] in ntdll (0x0134eb58) 5 0x7bc4c89e RtlpWaitForCriticalSection+0x100(crit=<couldn't compute location>) [/home/focht/projects/wine/wine.repo/src/dlls/ntdll/critsection.c:452] in ntdll (0x0134ec08) 6 0x7bc4cb6e RtlEnterCriticalSection+0xcb(crit=<couldn't compute location>) [/home/focht/projects/wine/wine.repo/src/dlls/ntdll/critsection.c:566] in ntdll (0x0134ec48) 7 0x7bc69441 attach_dlls+0x51(context=0x134fd24) [/home/focht/projects/wine/wine.repo/src/dlls/ntdll/loader.c:2976] in ntdll (0x0134ecd8) 8 0x7bc935f2 attach_thread+0xc3(entry=0x7684d5cf, arg=0x4090c88, suspend=0, relay=0x7bc93334) [/home/focht/projects/wine/wine.repo/src/dlls/ntdll/signal_i386.c:2999] in ntdll (0x0134efe8) 9 0x7bc932f0 start_thread+0x2b() in ntdll (0x00000000) --- snip ---
The problem is the teardown sequence in 'IDirectMusicSynthSinkImpl_Release' -> 'IReferenceClock_Release'.
https://source.winehq.org/git/wine.git/blob/85635db0ea7c4a8fee6612fe10c9d4aa...
--- snip --- 73 static ULONG WINAPI IDirectMusicSynthSinkImpl_Release(LPDIRECTMUSICSYNTHSINK iface) 74 { 75 IDirectMusicSynthSinkImpl *This = impl_from_IDirectMusicSynthSink(iface); 76 ULONG ref = InterlockedDecrement(&This->ref); 77 78 TRACE("(%p)->(): new ref = %u\n", This, ref); 79 80 if (!ref) { 81 if (This->latency_clock) 82 IReferenceClock_Release(This->latency_clock); 83 HeapFree(GetProcessHeap(), 0, This); 84 DMSYNTH_UnlockModule(); 85 } 86 87 return ref; 88 } --- snip ---
https://source.winehq.org/git/wine.git/blob/85635db0ea7c4a8fee6612fe10c9d4aa...
--- snip --- 182 static BOOL SystemClockPostMessageToAdviseThread(SystemClockImpl* This, UINT iMsg) { 183 if (FALSE == This->adviseThreadActive) { 184 BOOL res; 185 This->adviseThread = CreateThread(NULL, 0, SystemClockAdviseThread, This, 0, &This->adviseThreadId); 186 if (NULL == This->adviseThread) return FALSE; 187 SetThreadPriority(This->adviseThread, THREAD_PRIORITY_TIME_CRITICAL); 188 This->adviseThreadActive = TRUE; 189 while(1) { 190 res = PostThreadMessageW(This->adviseThreadId, iMsg, 0, 0); 191 /* Let the thread creates its message queue (with MsgWaitForMultipleObjects call) by yielding and retrying */ 192 if (!res && (GetLastError() == ERROR_INVALID_THREAD_ID)) 193 Sleep(0); 194 else 195 break; 196 } 197 return res; 198 } 199 return PostThreadMessageW(This->adviseThreadId, iMsg, 0, 0); 200 } ... 227 static ULONG WINAPI SystemClockImpl_Release(IReferenceClock* iface) { 228 SystemClockImpl *This = impl_from_IReferenceClock(iface); 229 ULONG ref = InterlockedDecrement(&This->ref); 230 TRACE("(%p): ReleaseRef to %d\n", This, ref); 231 if (ref == 0) { 232 if (SystemClockPostMessageToAdviseThread(This, ADVISE_EXIT)) { 233 WaitForSingleObject(This->adviseThread, INFINITE); 234 CloseHandle(This->adviseThread); 235 } 236 This->safe.DebugInfo->Spare[0] = 0; 237 DeleteCriticalSection(&This->safe); 238 CoTaskMemFree(This); 239 } 240 return ref; 241 } --- snip ---
There was no ReferenceClock::AdviseTime/AdvisePeriodic call prior hence the SystemClock advise thread was never created.
During teardown, the advise thread is created for no reason - and even more worse it's actually created during DllMain/PROCESS_DETACH which is a big no-no (reason for the loader deadlock).
If you fix this, the app terminates properly (already tested).
$ sha1sum WRPGE_Eng_v2.10B_Sample_Game.zip 7edab7b4dc319fce5dc93c8b5d8463a64771a8b2 WRPGE_Eng_v2.10B_Sample_Game.zip
$ du -sh WRPGE_Eng_v2.10B_Sample_Game.zip 21M WRPGE_Eng_v2.10B_Sample_Game.zip
$ wine --version wine-3.0-180-g85635db0ea
Regards