New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: crash on opening Multiplayer #9730
Comments
Okay, seems we have some logic errors in OpenTTD/src/network/core/tcp_connect.cpp Line 370 in 802ca4e
prints the IPv6 "connection refused" error. Next OpenTTD/src/network/core/tcp_connect.cpp Line 403 in 802ca4e
is called, despite not having an actual connection yet. Lastly, OpenTTD/src/network/core/tcp_connect.cpp Line 405 in 802ca4e
gives the "bad file desecriptor", indicating we are calling |
A quick fix seems to be to open up |
I already have a quick fix that has gotten me up and running again without needing to remove the server I usually play on, thanks. Anyway, with your PR (and a debug build) it asserts, though not in a new assert.
It seems likely that this is related to my configured servers. I have two configured, the first one is a hostname which has both an IPv4 and IPv6 address and the second is an IPv4 address literal. Neither server is running when the crash occurs. Anyway, I'm not especially interested in engaging with this issue. I have a workaround that fixes my problem, and I'm satisfied with it. If you have any questions regarding reproducing it, I'm happy to answer, but I'm not likely to try various patches and report if it worked or not, nor am I going to debug the issue any further on my own. One thing I noticed in passing is that there's a comment before the assert that is hit that "At this point, there is at least one socket connected" or something along those lines. This is clearly false. |
Tnx for the backtrace, that confirms what I am suspecting .. Basically, it is a matter of poor timing of the network stack. IPv6 takes more than 250ms to realise it cannot connect. By that time an IPv4 connection is attempted, but before that is connected, the IPv6 reports it failed to connect. That in result causes our code to get confused, and use an invalid socket. Now for a fix ... which is widely more difficult ... |
Right, I think #9731 solves the problem, and even allows you to connect to your favorite server (I think you currently cannot, or at least, I suspect it often fails). If you feel like it, I surely could use the confirmation it resolves the issue for you too. If not, that is fine, I could somewhat reproduce the issue and it at least solves a problem for sure :D |
…ace condition A race condition happens when an IPv6 connection takes more than 250ms to report an error, but does return before the IPv4 connection is established. In result, an invalid socket might be used for that connection.
… to a race condition A race condition happens when an IPv6 connection takes more than 250ms to report an error, but does return before the IPv4 connection is established. In result, an invalid socket might be used for that connection.
…ace condition A race condition happens when an IPv6 connection takes more than 250ms to report an error, but does return before the IPv4 connection is established. In result, an invalid socket might be used for that connection.
Version of OpenTTD
12.1, FreeBSD
Expected result
No crash
Actual result
As reported in #9728 by @RealDeuce.
With
-dnet=6
:Steps to reproduce
The text was updated successfully, but these errors were encountered: