-
Notifications
You must be signed in to change notification settings - Fork 188
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
Failed to handshake with localhost mongo #3346
Comments
I tried to reproduce locally on Linux, but for me it worked with truffleruby-dev (in Native mode):
Could you try with the dev version of the Native Standalone (see the README)? |
It also works with
I wonder if the issue is this 10 seconds timeout + running on a different machine & platform (macOS). |
I was able to reproduce on macOS 14.1.2 with an M1 Pro running a 24.0.0-dev build. I haven't looked any further than that, however, so I'm not yet sure what's at fault.
|
@eregon Native dev also doesn't work:
Thanks @nirvdrum! This is likely a macOS issue? |
Right, so it seems macOS-specific. |
To test that theory, @keang could you try with TruffleRuby 23.0 to see if it works there or if it's the same or different issue? |
I found that edge case on macOS, it only happens for MSG_OOB though, which I don't think mongo uses: 318148843f6#diff-4c37105fd6c10e347e8a274b39b2d26c7dc196bef32c5af3b940b974ed48d61b |
I couldn't install 23.0 as I have xcode 15.0, and as per this comment I could only install truffleruby-dev 🤔 unless I could cherry pick the changes
|
Looking around that code in mongo-ruby-driver it might be interesting to run with |
I reproduce the issue on macOS 13.4.1 (Intel) running truffleruby-dev and don't reproduce with 23.0.0: truffleruby-dev:
truffleruby-23.0.0:
|
Here's the output after enabling lint (I checked Mongo::Lint.enabled as well):
|
I paired with @andrykonchin and indeed it's related to TruffleRuby's poll() usage for IO.select. So I think this is a bug of macOS poll(2) which does not handle being called like: poll([{fd, POLLIN}, {fd, POLLPRI}], 2, 0) // hangs on macOS, fine on Linux Specifically it hangs even though the fd can be read (i.e., poll([{fd, POLLIN|POLLPRI}], 1, 0) // returns 3=POLLIN|POLLPRI, good Interestingly, this works fine on macOS: poll([{fd, POLLIN}, {fd, POLLOUT}], 2, 0) // returns [POLLIN, POLLOUT], so works fine on macOS So it sounds a specific issue for POLLPRI. The poll man page does not specify whether it's allowed or not to have the same fd in multiple I'll find a fix. Ideas so far:
|
@keang This is fixed now on truffleruby-head, and @andrykonchin verified it indeed works on macOS. |
I could not connect to mongo running on localhost.
On macOS 13.6, start mongo:
On both Truffleruby Native and Truffleruby JVM, I can't connect to that running mongo service:
On mri ruby it works fine:
It also works fine when connecting from an Amazon Linux 2 box to a remote mongo running on another EC2 box.
The text was updated successfully, but these errors were encountered: