https://bugs.winehq.org/show_bug.cgi?id=52024
Bug ID: 52024 Summary: App Never Receives Winsock FD_* Messages After FD_ACCEPT Product: Packaging Version: unspecified Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: wine-packages Assignee: wine-bugs@winehq.org Reporter: jbrown@statslog.com CC: dimesio@earthlink.net Distribution: ---
Created attachment 71023 --> https://bugs.winehq.org/attachment.cgi?id=71023 Broken +server,+winsock Trace from 6.x
I'm using a 32-bit Wine 6.21devel prefix on Ubuntu 20.04.3. I have a custom application written in VB6 that uses the winsock (ws2_32.dll) API to listen for network connections and respond to requests.
I use the following winetricks:
DISPLAY=:99 winetricks -q vcrun2008 DISPLAY=:99 winetricks -q vcrun2010 DISPLAY=:99 winetricks -q msxml6 DISPLAY=:99 winetricks -q corefonts DISPLAY=:99 winetricks -q vb6run
I run the application with the following command line:
WINEARCH="win32" WINEDLLOVERRIDES="oleaut32=n" wine RCWebServerTest.exe &
NOTE: I've tried both with and without the oleaut32 native override.
The application is able to bind OK to 127.0.0.1:8080, but when try to curl to it with the following command:
curl is able to connect to the application, but the application does not subsequently respond to the request.
Some debugging shows that the I'm receiving an FD_ACCEPT message in my app's socket windowproc, but unexpectedly I receive no other FD_ messages (notably, no FD_READ message).
After dumping +server,+winsock debug channels (attached), I see the server's "get_message" and "select" calls are apparently "stuck" in a PENDING state, with many repeated log messages along these lines:
0024: get_message( flags=00000000, get_win=00000000, get_first=00000000, get_last=ffffffff, hw_id=00000000, wake_mask=00000000, changed_mask=00000000 ) 0024: get_message() = PENDING { win=00000000, msg=00000000, wparam=00000000, lparam=00000000, type=0, x=0, y=0, time=00000000, active_hooks=80000001, total=0, data={} } 0024: select( flags=2, cookie=0031ef4c, timeout=infinite, size=8, prev_apc=0000, result={}, data={WAIT,handles={007c}}, context={} ) 0024: select() = PENDING { call={APC_NONE}, apc_handle=0000, context={} }
I've tried the exact same app on 5.x versions of Wine and it works as expected - curl connects and receives data from my application. I performed a similar +server,+winsock dump under the working 5.x version, and 2 things that stand out are that the 5.x series performs periodic "flush" calls, and the "get_message" and "select" calls never have a "PENDING" status. For example:
0009: flush( async={handle=0004,event=0000,iosb=0032ee10,user=006414b8,apc=00000000,apc_context=00000000} ) 0009: flush() = 0 { event=00d8 } 0009: select( flags=2, cookie=0032eadc, timeout=infinite, prev_apc=0000, result={}, data={WAIT_ALL,handles={00d8}} ) 0009: select() = 0 { timeout=infinite, call={APC_NONE}, apc_handle=0000 } 0009: get_message( flags=00000001, get_win=00000000, get_first=00000000, get_last=ffffffff, hw_id=00000000, wake_mask=00000000, changed_mask=00000000 ) 0009: get_message() = 0 { win=0001006c, msg=00000804, wparam=000000d4, lparam=00000001, type=6, x=0, y=0, time=a00af81e, active_hooks=80000001, total=0, data={} }
The attached working & broken logs are quite large, but if you search for FD_ACCEPT, that's where the curl connection gets accepted, and then the subsequent lines are where the problem is evident in the broken log (or expected behaviour is evident in the working log).
At this point I am stumped and not sure what else I can do to get the app working under Wine 6.x, as I believe that there is a bug that is beyond my capabilities to diagnose & fix.
Thank you in advance for any help, and If there's any additional information needed from me, I will provide it.
https://bugs.winehq.org/show_bug.cgi?id=52024
--- Comment #1 from Jason Brown jbrown@statslog.com --- Created attachment 71024 --> https://bugs.winehq.org/attachment.cgi?id=71024 Working +server,+winsock Trace from 5.x
https://bugs.winehq.org/show_bug.cgi?id=52024
Rosanne DiMesio dimesio@earthlink.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|wine-packages |winsock Version|unspecified |6.21 Product|Packaging |Wine
https://bugs.winehq.org/show_bug.cgi?id=52024
--- Comment #2 from Jason Brown jbrown@statslog.com --- Created attachment 71026 --> https://bugs.winehq.org/attachment.cgi?id=71026 Example Executable
https://bugs.winehq.org/show_bug.cgi?id=52024
Louis Lenders xerox.xerox2000x@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |xerox.xerox2000x@gmail.com Keywords| |download, regression
--- Comment #3 from Louis Lenders xerox.xerox2000x@gmail.com ---
I've tried the exact same app on 5.x versions of Wine and it works as expected - >curl connects and receives data from my application.
I think your best bet is to do a regression test then.
( I'll add 'regression' keyword to bugreport)
https://bugs.winehq.org/show_bug.cgi?id=52024
--- Comment #4 from Jason Brown jbrown@statslog.com --- Thanks Louis, I think you might be right about that.
https://bugs.winehq.org/show_bug.cgi?id=52024
Jason Brown jbrown@statslog.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Distribution|--- |Ubuntu
https://bugs.winehq.org/show_bug.cgi?id=52024
Zebediah Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |z.figura12@gmail.com
--- Comment #5 from Zebediah Figura z.figura12@gmail.com --- Created attachment 71367 --> https://bugs.winehq.org/attachment.cgi?id=71367 reselect acceptsock
The attached patch allows the application to get FD_READ, but then it crashes with a VB error:
"Run-time error '13': Type mismatch"
Is that the expected behaviour?
https://bugs.winehq.org/show_bug.cgi?id=52024
--- Comment #6 from Jason Brown jbrown@statslog.com --- Hi Zebediah,
Thank you for looking into this and for working on patch. I will so my best to review it, but please appreciate that this is a lower level than I am used to working with, so I will be a bit slow.
Lest you think I was trying to hand off the problem to you, I was not. I've been working on the regression testing as Louis suggested but it has been slow going. Each "make" takes about an hour, and I've been running the bisects in between all the other stuff I have to do, but I'm getting there! I'll attach my partial "git bisect log" momentarily.
It's been difficult because after many builds my test app often gets an error that looks like this:
wine: dlls/ntdll/unix/loader.c:779: load_ntdll_functions: Assertion `ntdll_exports' failed. Aborted (core dumped)
For those runs, I always used a "git bisect skip" command. I hope that was correct, but this is my first time trying this. My apologies if I haven't done this properly.
Lastly, "Run-time error '13': Type mismatch" is not the expected behaviour. I will post the output I am expecting to see tomorrow as I will have to build a known working version first.
Thanks again for taking the time to look into this, it is very much appreciated!
https://bugs.winehq.org/show_bug.cgi?id=52024
--- Comment #7 from Jason Brown jbrown@statslog.com --- Created attachment 71368 --> https://bugs.winehq.org/attachment.cgi?id=71368 git bisect log results.
https://bugs.winehq.org/show_bug.cgi?id=52024
--- Comment #8 from Zebediah Figura z.figura12@gmail.com --- Ah, sorry to step on your toes.
Since it's a socket-related regression, and since I did a bunch of socket-related changes in the past year which means it's almost certainly my fault, so I took the initiative and tried to debug it (which ended up being relatively easy even without knowing the exact regression commit).
Based on the fix I suspect the regression commit is c46ab05e55860. Debugging the rest is probably going to be hard.
https://bugs.winehq.org/show_bug.cgi?id=52024
--- Comment #9 from Jason Brown jbrown@statslog.com --- No need to apologize! You didn't step on my toes at all, and I really appreciate that you've taken the time to look into the issue. The work you (and others) do on Wine is amazing. I'm just a total newbie to the Wine debugging process, and this is my first bug report, regression test, etc... So I'm still learning. Just wanted to make sure that you didn't think I wandered off to let you fend for yourself.
https://bugs.winehq.org/show_bug.cgi?id=52024
--- Comment #10 from Jason Brown jbrown@statslog.com --- Zebediah, I just realized that your apology might be due to my use of the term "low-level". What I meant by that was you are working at level much closer to bare metal than I am used to, not that you are performing "low-level" of work. Your work is great, please keep it up!
https://bugs.winehq.org/show_bug.cgi?id=52024
--- Comment #11 from Zebediah Figura z.figura12@gmail.com --- No, I rather mean the "not trying to hand off the problem" part :-)
Anyway, I'll keep debugging, I meant to say that bisecting the nested regression (assuming that it is one and that I haven't screwed up in some other way) will probably be difficult, so probably not worth your time.
https://bugs.winehq.org/show_bug.cgi?id=52024
--- Comment #12 from Zebediah Figura z.figura12@gmail.com --- It seems to crash after failing to coerce the (ANSI) string "Hello!" to an integer. Do you have the source of this application? Can you provide any insight into why this is happening?
https://bugs.winehq.org/show_bug.cgi?id=52024
--- Comment #13 from Jason Brown jbrown@statslog.com --- (In reply to Zebediah Figura from comment #12)
It seems to crash after failing to coerce the (ANSI) string "Hello!" to an integer. Do you have the source of this application? Can you provide any insight into why this is happening?
I do have the source - the code shouldn't be trying to convert the ANSI string Hello! to an integer, instead it should be converting a Unicode (UTF-16LE) string "Hello!" to an ANSI string and store it in a byte array. The VB code looks like this:
Dim la_Bytes() As Byte ' Byte array
la_Bytes = StrConv("Hello!", vbFromUnicode) ' Convert from a Unicode string to an ANSI string and store it in a byte array.
One thing that I've found is that for VB apps under Wine it's almost always required to use the Native OLEAUT32.dll. If you install the VB6 runtime with "winetricks -q vb6run" that will install the native OLEAUT32.dll. You can then use the native override for that DLL and it might fix the problem.
https://bugs.winehq.org/show_bug.cgi?id=52024
--- Comment #14 from Jason Brown jbrown@statslog.com --- PS: I've been trying to build the latest source with your patch, but so far it's been failing. I'm trying to figure out a buildable commit to pull, so I'll keep trying and hopefully get it going.
https://bugs.winehq.org/show_bug.cgi?id=52024
--- Comment #15 from Zebediah Figura z.figura12@gmail.com --- Hrm, native oleaut32 doesn't seem to have helped. Sorry, I missed that from the first comment.
For reference, starting from a clean prefix, what I did was:
WINEARCH=win32 winetricks -q vcrun2008 vcrun2010 msxml6 corefonts vb6run
WINEDLLOVERRIDES=oleaut32=n wine RCWebServerTest.exe
then from another Unix terminal, `curl 127.0.0.1:8080`
(In reply to Jason Brown from comment #14)
PS: I've been trying to build the latest source with your patch, but so far it's been failing. I'm trying to figure out a buildable commit to pull, so I'll keep trying and hopefully get it going.
What specific problem are you encountering?
https://bugs.winehq.org/show_bug.cgi?id=52024
--- Comment #16 from Jason Brown jbrown@statslog.com --- (In reply to Zebediah Figura from comment #15)
Hrm, native oleaut32 doesn't seem to have helped. Sorry, I missed that from the first comment.
Darn :(
For reference, starting from a clean prefix, what I did was:
WINEARCH=win32 winetricks -q vcrun2008 vcrun2010 msxml6 corefonts vb6run
WINEDLLOVERRIDES=oleaut32=n wine RCWebServerTest.exe
then from another Unix terminal, `curl 127.0.0.1:8080`
That looks good to me, and is what I'm doing here too.
(In reply to Jason Brown from comment #14)
PS: I've been trying to build the latest source with your patch, but so far it's been failing. I'm trying to figure out a buildable commit to pull, so I'll keep trying and hopefully get it going.
What specific problem are you encountering?
After calling "git checkout master", I am building with the following command:
./configure --verbose --without-freetype && make
After a while of building, I get the following error:
dlls/winex11.drv/mouse.c: In function 'grab_clipping_window': dlls/winex11.drv/mouse.c:406:13: error: 'struct x11drv_thread_data' has no member named 'xi2_state' 406 | if (data->xi2_state != xi_enabled) | ^~ dlls/winex11.drv/mouse.c:406:28: error: 'xi_enabled' undeclared (first use in this function) 406 | if (data->xi2_state != xi_enabled) | ^~~~~~~~~~ dlls/winex11.drv/mouse.c:406:28: note: each undeclared identifier is reported only once for each function it appears in dlls/winex11.drv/mouse.c: At top level: dlls/winex11.drv/mouse.c:631:35: error: unknown type name 'XIRawEvent'; did you mean 'XMapEvent'? 631 | static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input ) | ^~~~~~~~~~ | XMapEvent dlls/winex11.drv/mouse.c: In function 'create_xcursor_system_cursor': dlls/winex11.drv/mouse.c:1131:25: warning: variable 'names' set but not used [-Wunused-but-set-variable] 1131 | const char * const *names = NULL; | ^~~~~ make: *** [Makefile:150419: dlls/winex11.drv/mouse.o] Error 1
If I subsequently try to create a new prefix and test RCWebServer.exe, I get this message:
wine: created the configuration directory '/home/statslog/.wine-test' wine client error:0: version mismatch 652/739. Your wineserver binary was not upgraded correctly, or you have an older one somewhere in your PATH. Or maybe the wrong wineserver is still running?
I've tried checking out a known "bad" version that I can build successfully, and there's no problem building/running, except I couldn't apply the patch exactly as you've written because it is an older version with different code in server/sock.c. I'm trying to find a commit that will build OK and has matching sock.c code that I can patch.
https://bugs.winehq.org/show_bug.cgi?id=52024
--- Comment #17 from Zebediah Figura z.figura12@gmail.com --- Looks like our build is broken if the XInput2 headers are missing. I'll send a patch to fix that, in the meantime you might try installing libxi-dev (or libxi-dev:i386) and reconfiguring.
https://bugs.winehq.org/show_bug.cgi?id=52024
--- Comment #18 from Jason Brown jbrown@statslog.com --- (In reply to Zebediah Figura from comment #17)
Looks like our build is broken if the XInput2 headers are missing. I'll send a patch to fix that, in the meantime you might try installing libxi-dev (or libxi-dev:i386) and reconfiguring.
Thanks for the help, I'm trying to rebuild now after installing libxi-dev.
https://bugs.winehq.org/show_bug.cgi?id=52024
--- Comment #19 from Jason Brown jbrown@statslog.com --- Sorry for the delay getting back to you Zebediah. I have finally been able to build and test the patch, and I am very happy to report that your patch restores the previous working behaviour. Thank you very much for looking into this issue and for fixing it!
https://bugs.winehq.org/show_bug.cgi?id=52024
Zebediah Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Regression SHA1| |c46ab05e55860a6c2ea774495c9 | |da8adff3eea00
https://bugs.winehq.org/show_bug.cgi?id=52024
Zebediah Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Fixed by SHA1| |b1a2238a10413af1437982dd80f | |0c61d216ec12e Status|UNCONFIRMED |RESOLVED
--- Comment #20 from Zebediah Figura z.figura12@gmail.com --- Fixed by https://source.winehq.org/git/wine.git/commitdiff/b1a2238a10413af1437982dd80f0c61d216ec12e.
https://bugs.winehq.org/show_bug.cgi?id=52024
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #21 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 7.0-rc4.