Closed theofficialgman closed 9 months ago
the root of this issue is that wine wineboot
leaves winedevice.exe
and wineserver
running when run with box64. this issue does not occur on x86_64
so on the latest wow64 build of wine, winedevice.exe is stuck?
so on the latest wow64 build of wine, winedevice.exe is stuck?
yes it appears so
I checked wine 8.19 and 8.20 and do not have stuck winedevice.exe
what are the next steps?
Not sure I have the same bahviour on my side. I get
174:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
0174:err:winediag:nodrv_CreateWindow L"The explorer process failed to start."
017c:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
017c:err:winediag:nodrv_CreateWindow L"The explorer process failed to start."
On my side all the time. There are many .exe process stuck also, not only winedevice.exe
after I try to run wincfg
I know that Wow64 build from kron4ek CI doesn't have the same issue. Did something changed on the the build process of wine?
I feel like this part (the isolated line) is not normal:
0054:trace:win:WIN_CreateWindowEx (null) #8001 ex=00000000 style=86000000 0,0 0x0 parent=0000000000000000 menu=0000000000000000 inst=0000000000000000 params=00007FFFFE2FF0C0
0054:trace:win:dump_window_styles style: WS_POPUP WS_CLIPSIBLINGS WS_CLIPCHILDREN
0054:trace:win:dump_window_styles exstyle:
0054:trace:win:WIN_CreateWindowEx (null) L"Message" ex=00000000 style=86000000 0,0 100x100 parent=0000000000000000 menu=0000000000000000 inst=0000000000000000 params=0000000000000000
0054:trace:win:dump_window_styles style: WS_POPUP WS_CLIPSIBLINGS WS_CLIPCHILDREN
0054:trace:win:dump_window_styles exstyle:
0054:trace:win:apply_window_pos win 0x10024 surface (nil) -> 0x7fff023354a0
0054:trace:win:NtUserCreateWindowEx hwnd 0x10024 cs 0,0 100x100 (0,0)-(100,100)
0054:trace:win:apply_window_pos win 0x10024 surface 0x7fff023354a0 -> 0x7fff023354a0
0054:trace:win:NtUserCreateWindowEx created window 0x10024
0054:trace:win:set_window_long 0xc0000005 -4 4043a0 W
0054:trace:win:NtUserSetWindowPos hwnd 0xc0000005, after (nil), 0,0 (2560x1440), flags 00000040
0054:trace:win:dump_winpos_flags flags: SWP_SHOWWINDOW
0054:trace:win:NtUserRedrawWindow 0x10020 whole window flags: RDW_INVALIDATE RDW_ERASE RDW_NOCHILDREN
0054:trace:win:NtUserClipCursor Clipping to (null)
00ac:trace:win:alloc_winproc_ptr allocated 0xffff000e for W 0x4022a0 (15/4096 used)
0054:trace:win:alloc_winproc_ptr allocated 0xffff000f for W 0x401210 (16/4096 used)
00ac:trace:win:WIN_CreateWindowEx (null) L"__wine_clipboard_manager" ex=00000000 style=00000000 0,0 0x0 parent=FFFFFFFFFFFFFFFD menu=0000000000000000 inst=0000000000000000 params=0000000000000000
the hwnd looks like a SEGFAULT error code. But I don't see any segfault or error or anything. Just the nodriver out of nowhere for now :(
This
0058:trace:win:invalidate_dce 0x30030 parent 0x10020 (0,0)-(166,52) ((0,0)-(0,0))
0058:trace:win:apply_window_pos win 0x30030 surface (nil) -> (nil)
0058:trace:win:NtUserCreateWindowEx hwnd 0x30030 cs 0,0 166x52 (0,0)-(166,52)
0058:trace:win:set_window_text L""
0058:warn:win:create_window_handle error 6 creating window
0058:trace:win:NtUserCreateWindowEx register IME window for 0x30030
0058:trace:win:invalidate_dce 0x30030 parent 0x10020 (0,0)-(166,52) ((0,0)-(166,52))
0058:trace:win:apply_window_pos win 0x30030 surface (nil) -> (nil)
0058:trace:win:NtUserCreateWindowEx created window 0x30030
0058:trace:win:show_window hwnd=0x30030, cmd=0, was_visible 0
0058:trace:win:alloc_winproc_ptr allocated 0xffff0012 for W 0x7a91b940 (19/4096 used)
0058:trace:win:WIN_CreateWindowEx (null) L"WineDdeEventClass" ex=00000000 style=80000000 0,0 0x0 parent=0000000000000000 menu=0000000000000000 inst=0000000000000000 params=0000000000000000
0058:trace:win:dump_window_styles style: WS_POPUP
0058:trace:win:dump_window_styles exstyle:
Also looks suspicious. But again, no actual error or hint about were this could go wrong.
The windows creation process does
015c:trace:win:WIN_CreateWindowEx L"Wine Explorer" L"ExplorerWClass" ex=00000000 style=00cf0000 -2147483648,-2147483648 640x480 parent=0000000000000000 menu=0000000000000000 inst=0000000000400000 params=0000000000000000
015c:trace:win:dump_window_styles style: WS_CAPTION WS_SYSMENU WS_THICKFRAME WS_MINIMIZEBOX WS_MAXIMIZEBOX
015c:trace:win:dump_window_styles exstyle:
015c:trace:win:get_min_max_info 2568 1408 / -4 -4 / 2572 1452 / 119 34
015c:trace:win:create_offscreen_window_surface visible_rect (0,0)-(640,480), surface 0x7ffffe0ff8b8.
015c:trace:win:create_offscreen_window_surface created window surface 0xffffb43d3010
015c:trace:win:invalidate_dce 0x10072 parent 0x30058 (0,0)-(640,480) ((0,0)-(0,0))
015c:trace:win:invalidate_dce 0x4010044: hwnd 0x30058 dcx 00000013 Cache
015c:trace:win:apply_window_pos win 0x10072 surface (nil) -> 0xffffb43d3010
015c:trace:win:NtUserCreateWindowEx hwnd 0x10072 cs 0,0 640x480 (0,0)-(640,480)
015c:trace:win:set_window_text L"Wine Explorer"
015c:trace:win:create_offscreen_window_surface visible_rect (0,0)-(1,1), surface 0x7ffffe0ff688.
015c:trace:win:create_offscreen_window_surface created window surface 0x4f8d2f10
015c:trace:win:invalidate_dce 0x10078 parent 0x30058 (0,0)-(1,1) ((0,0)-(0,0))
015c:trace:win:invalidate_dce 0x4010044: hwnd 0x30058 dcx 00000013 Cache
015c:trace:win:apply_window_pos win 0x10078 surface (nil) -> 0x4f8d2f10
015c:trace:win:NtUserCreateWindowEx hwnd 0x10078 cs 0,0 1x1 (0,0)-(1,1)
015c:trace:win:set_window_text L"Default IME"
015c:trace:win:create_offscreen_window_surface visible_rect (0,0)-(1,1), surface 0x7ffffe0ff688.
015c:trace:win:invalidate_dce 0x10078 parent 0x30058 (0,0)-(1,1) ((0,0)-(1,1))
015c:trace:win:invalidate_dce 0x4010044: hwnd 0x30058 dcx 00000013 Cache
015c:trace:win:apply_window_pos win 0x10078 surface 0x4f8d2f10 -> 0x4f8d2f10
015c:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
015c:err:winediag:nodrv_CreateWindow L"The explorer process failed to start."
015c:trace:win:destroy_window 0x10078
015c:trace:win:free_window_handle
But again, no clue on to why it errors out.
the root of this issue is that wine wineboot leaves winedevice.exe and wineserver running when run with box64. this issue does not occur on x86_64
But again, no clue on to why it errors out.
I think this has something to do with explorer.exe, and not winedevice.exe (or there's two somewhat-related issues).
I've been working on the new cross-platform docker image for Northstar (the Titanfall 2 custom server mod) (#210), and I've actually got a fully-working prototype using Wine 9.0-rc3 and 9b23c3272bd6e0cffef50e811627301e0b64ea42 (thanks @ptitSeb; performance is actually really good). The Wine build is the official WineHQ one, but slimmed down and patched (basically all GUI-related stuff is removed, 32-bit and WoW stuff is removed, explorer.exe is patched to load nulldrv by default -- which basically just returns a dummy value for every win32u call, and wine.inf is patched to remove pretty much every service other than winedevice -- which is needed for wineboot to not complain) (I was very through and careful with the slimming -- wineboot doesn't log errors about anything other than wow64 and ole). The Box64 configuration is here. For easier debugging, the entire /opt/northstar-runtime
folder can be extracted from the container and run on most recent glibc-based hosts (only tested on Debian Bookworm though).
This is relevant since I've noticed a few things while working on this:
WinSta
, then infinite epoll_pwait calls until explorer.exe is killed manually.P.S. To run northstar-runtime (as of 584141a901f2afa775a70b91d5c3e0c8d2ae4eda; it's still in development, so things could change) (if you want to play on the server, port-forward the udp port -- the external port must be identical, then configure the server name in R2Northstar/mods/Northstar.CustomServers/mod/cfg/autoexec_ns_server.cfg
) (you can run the same command on arm64 and amd64) (BOX64_*
and WINEDEBUG
env vars are passed through by nswrap -- everything else is removed or overridden):
mkdir titanfall
cd titanfall
wget https://gist.github.com/pg9182/9a962adbfc27e93237cd14e4523c9da8/raw/c21c0894a7298dd285bcce5277407be478a9e97e/nsfetch.sh
chmod +x nsfetch.sh
./nsfetch.sh # this downloads 2.5GB of files
wget https://github.com/R2Northstar/Northstar/releases/download/v1.21.4/Northstar.release.v1.21.4.zip
unzip Northstar.release.v1.21.4.zip
docker pull ghcr.io/pg9182/northstar-runtime
# option 1: run the docker container
# note: you can pass box64 env vars with the docker -e flag
# note: you can override the box64 binary by bind-mounting it with something like -v (I have two minor [patches](https://github.com/pg9182/NorthstarDocker/blob/584141a901f2afa775a70b91d5c3e0c8d2ae4eda/runtime/Dockerfile#L306-L311) in my build, but they aren't critical)
docker run --rm -it -v $PWD:/mnt --network host ghcr.io/pg9182/northstar-runtime -dedicated +setplaylist aitdm +launchplaylist aitdm +port 37015
# option 2: get a shell in the container, then run nswrap manually (potentially installing additional tools in it)
docker run --rm -it -v $PWD:/mnt --network host --entrypoint /bin/bash ghcr.io/pg9182/northstar-runtime
/opt/northstar-runtime/bin/nswrap -dedicated +setplaylist aitdm +launchplaylist aitdm +port 37015
# option 3: extract it and run it externally
# note: to see the thing about it not exiting, press ctrl+c twice (that SIGTERMS the main wine process) (NOT 3 times -- that SIGKILLS the main wine process, which is inherently not a clean exit) at some point after the MountVPK logs, and look at the process list -- it'll timeout while waiting for wine to completely exit, and it'll leave behind wineserver, explorer.exe, services.exe, and winedevice.exe
docker run --rm -v $PWD:/mnt --network host --entrypoint /usr/bin/tar ghcr.io/pg9182/northstar-runtime cf - -C /opt northstar-runtime | tar xvf - # this might appear to hang at the end -- it's not stuck, it just takes a little bit of time
./northstar-runtime/bin/nswrap -dedicated +setplaylist aitdm +launchplaylist aitdm +port 37015
Regarding my slimmed/patched wine build for the northstar dedicated server, the only absolutely required patches are as follows. The rest of the removals are done to minimize the size of the docker image, and to reduce the number of extraneous processes for simplicity.
Regarding the createwindow errors, they shouldn't prevent wineboot from working correctly if that's all there is (proof: init a wineprefix on x64, but unset DISPLAY and WAYLAND_DISPLAY, then successfully run cmd
or another console application to prove the prefix works correctly). If you force the use of nulldrv like I did for the Northstar dedicated server (which has to return success from CreateWindow and have a working window loop, but doesn't actually show anything we care about on the window), you can sidestep those errors entirely (albeit without a GUI).
Ok, thanks I'll look into this also, to see if I can isolate what's going wrong
Ok, I reproduce the explorer.exe
not quitting properly (using option 3).
Unfortunatly, I see no error or anything suspicious. I just doesn't work properly for no apparent reason :(
So I still don't know were to look for an issue.
Doing some regression testing with pi-apps wine-wow64 build, it seems the issue appeared with wine-8.21. On wine-8.20, everything seems to work fine for me. With 8.21 and later, no more explorer.exe or window openning (using a fresh prefix or not).
Doing some regression testing with pi-apps wine-wow64 build, it seems the issue appeared with wine-8.21. On wine-8.20, everything seems to work fine for me. With 8.21 and later, no more explorer.exe or window openning (using a fresh prefix or not).
Yeah that was my experience as well. Sorry should have posted that I originally noticed the issue in wine-8.21 and not lower versions. As said previously, I don't see any problems when using these builds on an x86_64 PC.
Keep this thread updated if you find any new information but I understand if you don't find anything and let it sit for a while, that is ok too.
In this fixed by https://github.com/ptitSeb/box64/commit/328d5c6275b69edf336eac595fe2e41ab8410a65 ? Because he mentioned testing wine explorer.exe
In this fixed by 328d5c6 ? Because he mentioned testing wine explorer.exe
Considering that's a one line commit on the risv5 dyarec, no it's not fixed.
https://bugs.winehq.org/show_bug.cgi?id=56130 Perhaps it's fixed now in Wine 9.0 rc5?
Just tried wine-9.0 with box64....explorer failed to launch so I believe this issue is still present
@ptitSeb could you write down the recommended wine version to use for box64? i can only use the wow64 version so does wow64 work at all?
@ptitSeb could you write down the recommended wine version to use for box64? i can only use the wow64 version so does wow64 work at all?
wine 8.20 seems to be the last working version. I'm working on this issue, but it will take time to fix as I still have no idea what is going wrong there.
yeah, 8.20 is also my finding.
I hope you'll be able to sort this out because they restored compatibility with termux now in 9.0 rc3. This means that after this bug gets fixed in box64, all projects such as Box64Droid, Winlator etc, should be able to use Wine 9.0 (or the GE fork).
Incase someone wants to go through the diff between wine 8.21 and wine 8.20 to see if the changes can give any suggestion for where to look for the issue https://gitlab.winehq.org/wine/wine/-/compare/wine-8.20...wine-8.21?from_project_id=5&straight=false
Incase someone wants to go through the diff between wine 8.21 and wine 8.20 to see if the changes can give any suggestion for where to look for the issue https://gitlab.winehq.org/wine/wine/-/compare/wine-8.20...wine-8.21?from_project_id=5&straight=false
Good idea, but the diff is partial, not all comits get listed and I don't see where I get another page of commits.
@theofficialgman I tried to build wine-8.21 to see if I can bisect the issue localy. But my local 8.21 build (with Wow64 of course) just works on my side. What configure parameter are you using for the Wow64 built?
@theofficialgman I tried to build wine-8.21 to see if I can bisect the issue localy. But my local 8.21 build (with Wow64 of course) just works on my side. What configure parameter are you using for the Wow64 built?
same instructions as always. bump version variable and update url as necessary https://github.com/Pi-Apps-Coders/files/blob/main/CompileCommands/Apps/Wine%20(x64).md
@theofficialgman I tried to build wine-8.21 to see if I can bisect the issue localy. But my local 8.21 build (with Wow64 of course) just works on my side. What configure parameter are you using for the Wow64 built?
same instructions as always. bump version variable and update url as necessary https://github.com/Pi-Apps-Coders/files/blob/main/CompileCommands/Apps/Wine%20(x64).md
No, I don't want to install the pi-apps package, I want to build wine the same way pi-apps does, because my local build works fine. What configure
command line is used to build wine. I used CFLAGS="-march=core2 -O2" ../configure --enable-archs=i386,x86_64
(also with a custom prefix) on my side.
same instructions as always. bump version variable and update url as necessary
No, I don't want to install the pi-apps package, I want to build wine the same way pi-apps does,
Yeah I know. Click the link. I sent you the buildscript. We have all our buildscripts public for binaries distributed in pi-apps.
same instructions as always. bump version variable and update url as necessary
No, I don't want to install the pi-apps package, I want to build wine the same way pi-apps does,
Yeah I know. Click the link. I sent you the buildscript. We have all our buildscripts public for binaries distributed in pi-apps.
Oh, sorry, I didn't noticed it was the build script.
Looking at it, it's mostly the same command I'm using on side. I just use a specific CFLAGS. I'm build on a debian instance with gcc-13. On what it is built on pi-apps side? I don't understand why I don't have the same result. I'll build again without the CFLAGS....
On what it is built on pi-apps side? I don't understand why I don't have the same result. I'll build again without the CFLAGS....
same repo, root folder has the ubuntu bionic chroot instructions https://github.com/Pi-Apps-Coders/files/blob/main/CompileCommands/README.md
in this case it is an amd64 ubuntu bionic chroot.
Ok, Without the CFLAGS, I reproduced the issue with my 8.21 build! Now, I'll build 8.20 and see if it works. Then I can start the bisect :)
So, bisect done. The commit is df181df8ee5930f19327324593ecd54b3cc7fc26, which is "ntdll: Add a syscall_cfa member to the x86_64 syscall frame." So prbably box64 stack setup during signal is not 100% correct.
Ok, I think I found root cause of the issue. The stack pointer was mis-aligned in a pthread_once
callback and some value got overwriten (mix with RSP/RBP relative access and eroneous rounded RSP becauseof the misalignement).
It should work now with latest box64.
currently on wine 9.0, winedevice.exe is stuck when running winetricks vcrun2008
wine cache was cleared at the start. the following get run in a loop and I am stuck when I get to vcrun2008
for i in mfc42 vcrun6 vcrun2003 fontfix corefonts gdiplus msxml3 vcrun2005sp1 vcrun2008 ;do
echo
status "Installing \$i with winetricks..."
winetricks \$i
done
tried again, cleared cache, exact same script and it did not hang this time.... so I guess just unstable as usual
tested on x86_64 with the same build and no issues.
hangs on box64 with this above output ^. fresh wine prefix used.
install instructions