-
Notifications
You must be signed in to change notification settings - Fork 185
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
Segfault in IO.select
#3201
Comments
So it must be from this line: ready, _write, _errors = IO.select(sockets, nil, nil, timeout) It could be an issue in truffleposix_select() (more likely) or in NFI. I wonder if it's a case of a file descriptor being > FD_SETSIZE (1024).
|
There is Another idea would be to use |
I tried to reproduce this with:
On TruffleRuby:
So interestingly CRuby raises EMFILE for what would be fd 1024. At least what we can do is add a check in IO.select to raise if fd > FD_SETSIZE. |
open(2) mentions:
and getrlimit(2) mentions:
And the default limit for me is
|
On CRuby if we set the limit then it works with higher fds:
|
I have a branch reimplementing |
* This avoids the issue of file descriptors >= 1024 that FD_ZERO does not handle. * Fixes #3201
* This avoids the issue of file descriptors >= 1024 that FD_ZERO does not handle. * Fixes oracle#3201 * Skip TestIO#test_select_exceptfds on macOS, macOS's poll(2) is buggy with TCP MSG_OOB or macOS does not really support MSG_OOB: For a fd to which out-of-band data has been sent, poll() with POLLIN|POLLPRI returns POLLRDNORM|POLLPRI|POLLIN on Linux (correct) but POLLRDNORM|POLLIN on macOS (bug). poll() with just POLLPRI works fine on Linux but hangs on macOS (bug). It seems a bug of macOS poll() not handling TCP MSG_OOB. The man page of poll() on macOS talks about: "The distinction between normal, priority, and high-priority data is specific to particular file types or devices." but gives no details, it seems a mess. MSG_OOB is poorly supported across platforms anyway and extremely rarely if ever used.
I have a Rails application that periodically segfaults. The hs_err log indicates it's stemming from the dnsruby gem as it calls
IO.select
. I'm seeing this with TruffleRuby 23.0.0 on Oracle GraalVM running in JVM mode. The gem is used by an in-house gem that wraps around ruby-kafka. As the hs_err shows, there's a background thread that does periodic DNS checks.I haven't yet debugged the code to see what values are flowing through the system when the error occurs. The dnsruby gem uses class variables for various bits of state and I haven't yet verified the thread-safety of that code.
hs_err.log
The text was updated successfully, but these errors were encountered: