-
-
Notifications
You must be signed in to change notification settings - Fork 253
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
to_stream and nonblocking sockets #723
Comments
Maybe use |
I'm hesitant to make that the default but it would be a nice option for |
Looking at this again. I think I misunderstood the desired changes. I don't think Oj should set the stream to non blocking but I do think Oj could handle EAGAIN errors along with some timeout value. I'm looking into that now. |
Please try branch "non-blocking". Test added as well although I found the issue is exposed more readily with a large single write instead of many smaller ones and the test reflects that. |
I believe the non-blocking branch fixes the issue. I plan to release tomorrow barring feedback from you indicating it is not fixed. |
Okay to close? |
is the patch included in oj 3.13.11? The example in the original issue still fails with it |
Since Ruby 3.0 sockets are by default nonblocking, which causes issues for
Oj.to_stream
hereoutput:
set
s.nonblock = false
and it works as expected..Not sure if something should be done in
Oj
, but could be good for ppl to be aware.. It's not very ergonomic to catch the genericIOError
and then trying to figure out if it's aEAGAIN
error and manually doIO.select
.The text was updated successfully, but these errors were encountered: