https://bugs.winehq.org/show_bug.cgi?id=50520
Bug ID: 50520 Summary: Any Rust-Lang application: Cannot create an async tcp connection Product: Wine Version: 5.0 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: major Priority: P2 Component: winsock Assignee: wine-bugs@winehq.org Reporter: winehq@greaka.de Distribution: ---
Created attachment 69183 --> https://bugs.winehq.org/attachment.cgi?id=69183 minimal example
Rust applications are not able to use async libraries in wine. TCP connections send Syn, receive Syn/Ack, send Reset.
Test matrix: - Wine versions 5.0, 5.8, 5.22, 6.0rc0 , 6.0rc6 - Ubuntu, Arch - WSL, native on laptop - Tokio, Smol, Async-Std (Smol and async-std use the same under the hood) - Rust versions 1.48 stable, 1.49 stable, 1.50 beta - Targets windows-gnu, windows-msvc - Toolchains gnu, msvc
Every combination fails to connect.
Minimal example source code: https://pastebin.com/SZavTYD7 precompiled binary 1.50 beta/windows-msvc/msvc attached. The example expects a listener on localhost:41206! You can easily open one with ncat -l -k -p 41206
The error returned to rust: [src\main.rs:10] TcpStream::connect(addr.as_slice()).await = Err( Os { code: 10045, kind: Other, message: "OS Error 10045 (FormatMessageW() returned error 317)", }, )
Trace from wineserver: Short version https://cdn.discordapp.com/attachments/596410107726921728/798862803648643082... Long version https://cdn.discordapp.com/attachments/596410107726921728/798858758411386880...
https://bugs.winehq.org/show_bug.cgi?id=50520
Zebediah Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |z.figura12@gmail.com
--- Comment #1 from Zebediah Figura z.figura12@gmail.com --- Thanks. It's using some undocumented internal socket details.
As a side note, it's crashing on my main development machine, with an illegal instruction. Disassembly shows it's trying to use the instruction
14002185c: c4 e2 f3 f6 c9 mulx %rcx,%rcx,%rcx
which requires the BMI2 extension, which my processor don't have. I don't know if this is a bug (i.e. if the program is supposed to detect a missing extension on Windows), but either way it's hampering my development somewhat; is it possible for you to provide an executable tuned for earlier CPUs?
https://bugs.winehq.org/show_bug.cgi?id=50520
Greaka winehq@greaka.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #69183|0 |1 is obsolete| |
--- Comment #2 from Greaka winehq@greaka.de --- Created attachment 69212 --> https://bugs.winehq.org/attachment.cgi?id=69212 Minimal example
Replaced the compiled minimal example to not include any new extensions.
https://bugs.winehq.org/show_bug.cgi?id=50520
--- Comment #3 from Greaka winehq@greaka.de --- Hey, I've updated the compiled binary to not include any extensions now :)
https://bugs.winehq.org/show_bug.cgi?id=50520
--- Comment #4 from Zebediah Figura z.figura12@gmail.com --- Created attachment 69217 --> https://bugs.winehq.org/attachment.cgi?id=69217 huge afd mess
Thanks, that works.
I'm attaching a diff here that implements the necessary behaviour. It's a huge mess right now, but there's an awful lot of work that needs to be done before this can be upstreamed.
https://bugs.winehq.org/show_bug.cgi?id=50520
whitequark@whitequark.org changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |whitequark@whitequark.org
--- Comment #5 from whitequark@whitequark.org --- I was unlucky enough to track down the cause of this bug independently in nearly the exact same time interval, except I filed it against mio because I see it as an abuse of a private API: https://github.com/tokio-rs/mio/issues/1444
https://bugs.winehq.org/show_bug.cgi?id=50520
--- Comment #6 from whitequark@whitequark.org --- Zebediah, I think your patch is missing dlls/ws2_32/tests/afd.c.
https://bugs.winehq.org/show_bug.cgi?id=50520
--- Comment #7 from Zebediah Figura z.figura12@gmail.com --- (In reply to whitequark from comment #6)
Zebediah, I think your patch is missing dlls/ws2_32/tests/afd.c.
It is, yeah; that was an accident. It's just unit tests though; it can be removed from Makefile.in.
https://bugs.winehq.org/show_bug.cgi?id=50520
--- Comment #8 from whitequark@whitequark.org --- I've built wine with your patch and verified it against ALVR. It seems to work fine, though ALVR still has other crashes that I haven't tracked down yet.
https://bugs.winehq.org/show_bug.cgi?id=50520
charkins@pobox.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |charkins@pobox.com
https://bugs.winehq.org/show_bug.cgi?id=50520
servvs servus.malus@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |servus.malus@gmail.com
--- Comment #9 from servvs servus.malus@gmail.com --- (In reply to Zebediah Figura from comment #4)
Created attachment 69217 [details] huge afd mess
Thanks, that works.
I'm attaching a diff here that implements the necessary behaviour. It's a huge mess right now, but there's an awful lot of work that needs to be done before this can be upstreamed.
I would like to test this patch out, but I can't figure out which commit this patch is for. Can someone enlighten me on this?
https://bugs.winehq.org/show_bug.cgi?id=50520
--- Comment #10 from Zebediah Figura z.figura12@gmail.com --- (In reply to servvs from comment #9)
(In reply to Zebediah Figura from comment #4)
Created attachment 69217 [details] huge afd mess
Thanks, that works.
I'm attaching a diff here that implements the necessary behaviour. It's a huge mess right now, but there's an awful lot of work that needs to be done before this can be upstreamed.
I would like to test this patch out, but I can't figure out which commit this patch is for. Can someone enlighten me on this?
"current git" at the time, probably, but offhand I think it should apply (mostly) on wine 6.0.
I'll try to push a more organized git branch somewhere in the near future.
https://bugs.winehq.org/show_bug.cgi?id=50520
--- Comment #11 from servvs kostile@gmail.com --- (In reply to Zebediah Figura from comment #10)
(In reply to servvs from comment #9)
(In reply to Zebediah Figura from comment #4)
Created attachment 69217 [details] huge afd mess
Thanks, that works.
I'm attaching a diff here that implements the necessary behaviour. It's a huge mess right now, but there's an awful lot of work that needs to be done before this can be upstreamed.
I would like to test this patch out, but I can't figure out which commit this patch is for. Can someone enlighten me on this?
"current git" at the time, probably, but offhand I think it should apply (mostly) on wine 6.0.
I'll try to push a more organized git branch somewhere in the near future.
I'm not having much luck with this patch. It always fails at
error: patch failed: server/sock.c:568 error: server/sock.c: patch does not apply
I've tried it on a few of the most recent commits and the ones from Jan 2nd and Jan 22nd that have changes in server/sock.c both fail with this. It looks like there are other changes in this file that aren't a part of this patch. I did try to manually edit the file but that results in applications using the internet to freeze.
https://bugs.winehq.org/show_bug.cgi?id=50520
--- Comment #12 from Zebediah Figura z.figura12@gmail.com --- I've pushed a branch to https://repo.or.cz/wine/zf.git/shortlog/refs/heads/sock4 which contains all of my socket-related work thus far, including the changes necessary to allow this application and Starcraft Remastered to work. The branch is based on current git (4904d90870a at the time of writing).
https://bugs.winehq.org/show_bug.cgi?id=50520
Zebediah Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Blocks| |50974
https://bugs.winehq.org/show_bug.cgi?id=50520
Zebediah Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|Any Rust-Lang application: |Multiple applications need |Cannot create an async tcp |WSAIoctl(SIO_BASE_HANDLE) |connection |(Rust applications using | |the Mio or Smol libraries, | |Starcraft Remastered) Keywords| |download, patch
--- Comment #13 from Zebediah Figura z.figura12@gmail.com --- There are essentially three bugs, in order, affecting this application:
(1) it needs an implementation of WSAIoctl(SIO_BASE_HANDLE),
(2) it fails to open \Device\Afd\Wepoll,
(3) it tries to use undocumented "poll" ioctl 0x12027.
The same three bugs affect Starcraft Remastered (reported as bug 50366), which also needs undocumented "recv" ioctl 0x12014. I'm collecting and splitting the bug reports so that they target these four individual problems rather than the individual applications.
https://bugs.winehq.org/show_bug.cgi?id=50520
Ivar Kamsvåg ivar.kamsvag@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |ivar.kamsvag@gmail.com
--- Comment #14 from Ivar Kamsvåg ivar.kamsvag@gmail.com --- I'm dealing with an application suffering from what I believe to be this bug (tokio failing to find "\Device\Afd\Mio"), however after compiling and running it with the latest sock4 branch linked above the problem persists. Lutris shows the runner as Wine 6.8 (different from my system wine and in line with the version provided by the zf sock4 branch). Did I miss a step in using the patched wine or is it simply that it's not a universal fix (my application is entirely unrelated to Starcraft or such, I can elaborate if needed).
https://bugs.winehq.org/show_bug.cgi?id=50520
--- Comment #15 from Zebediah Figura z.figura12@gmail.com --- (In reply to Ivar Kamsvåg from comment #14)
I'm dealing with an application suffering from what I believe to be this bug (tokio failing to find "\Device\Afd\Mio"), however after compiling and running it with the latest sock4 branch linked above the problem persists. Lutris shows the runner as Wine 6.8 (different from my system wine and in line with the version provided by the zf sock4 branch). Did I miss a step in using the patched wine or is it simply that it's not a universal fix (my application is entirely unrelated to Starcraft or such, I can elaborate if needed).
I double-checked and the test case attached here still works, so I suspect that your application is affected by a different bug. Can you please file a new bug report and give further details?
https://bugs.winehq.org/show_bug.cgi?id=50520
Maciej Stanczew maciej.stanczew+b@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |maciej.stanczew+b@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=50520
robert.roth.off@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |robert.roth.off@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=50520
Zebediah Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|UNCONFIRMED |RESOLVED Fixed by SHA1| |8698083dd05a375615a772fa83a | |6b26747a40708
--- Comment #16 from Zebediah Figura z.figura12@gmail.com --- Fixed by https://source.winehq.org/git/wine.git/commitdiff/8698083dd05a375615a772fa83a6b26747a40708.
https://bugs.winehq.org/show_bug.cgi?id=50520
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #17 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 6.11.
https://bugs.winehq.org/show_bug.cgi?id=50520
Zebediah Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |darinsmiller@gmail.com
--- Comment #18 from Zebediah Figura z.figura12@gmail.com --- *** Bug 51229 has been marked as a duplicate of this bug. ***