-
Notifications
You must be signed in to change notification settings - Fork 6
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
Binding to wildcard "0.0.0.0" then connecting throws ConnectException
on macOS
#92
Comments
On my macOS 11 machine the
(the port number varies per-run) Furthermore, if I change the connect(new InetSocketAddress("0.0.0.0", addr.asInstanceOf[InetSocketAddress].getPort)) Then the test passes. @LeeTibbert could this be another case of getting an IPv4-compatible address instead of an IPv4-mapped address? |
Arman, I think you have it exactly! I will have to trace through the code. When I did the PR to the similar issue I let |
Arman, I've spent a long morning tracing this and think I have an understanding of two of the things, plural, Overnight I will work on coming up with a good description of "what", then we can work out |
Progress but no solution, then again, one can progress around a ring and not I ratted around and found a python IPv6 client/server pair that I had been using Thinking that python might be "helping" me under the covers, I cobbled together I think the code thru the server is doing a sensible thing (but plenty of room for discussion later). More as I discover it. Time consuming as it is, I am glad you discovered this issue. |
Thanks for the update :) I also ratted around in Node.js and libuv, and am hitting the same wall. Surely some other implementation has encountered these "quirks" and taken defensive measures, but I'm yet to stumble on it. However, being unable to reproduce in a C implementation ... is interesting and unexpected 😅 is there any possibility that Scala Native is doing something during startup/initialization that could lead to this? It would explain why a vanilla C implementation behaves differently. |
I believe the simple C programs worked and epollcat revealed the underlying OS failure/behavior More next sprint, when my mind has untangled. |
As promised, the factors behind PR #93. There are a number of factors which make this Issue and the proposed fix interesting. Most of the below could each take a week or so pouring over the relevant International
Summary: The test code is written to send a ::0 wildcard address to the client_ch, Possible fixes:
Conclusion: So you thought special casing was time consuming and ugly. |
Thanks for the detailed write-up. Suffice to say, it's taken me more than a few passes for I think we can all agree that a large part of the problem is the early allocation of the socket file descriptor, before we know whether we want AF_INET or AF_INET6. I blame the poor design of the JDK in this area which leaves us in a bad position. I am not sure if either of proposals has semantics that match the JDK, which would make it difficult to use in cross-compiling code. The real answer is, implement a different (better) API. Something that bugs me is what feels like an "asymmetry": specifically, that you can bind a socket to |
Linux & macOS IPv4 obviously agree with you (as do I). A lot turns on "get the local address of said socket". Rolling the discussion way back, connect(0.0.0.0) & connect(::0) should both be rejecting the connection Life in network land. And a reason to have good libraries, such as epollcat, where a lot |
…2-11-23T1639-0500 Fix #92: Special case connecting to wildcard on macOS
Reproducer in 6c3ea7e.
epollcat/tests/shared/src/test/scala/epollcat/TcpSuite.scala
Lines 244 to 254 in 6c3ea7e
The text was updated successfully, but these errors were encountered: