-
Notifications
You must be signed in to change notification settings - Fork 81
Check whether TCPSocket#initialize supports open_timeout once and without exceptions #252
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
Check whether TCPSocket#initialize supports open_timeout once and without exceptions #252
Conversation
…hout exceptions * See discussion in ruby#224 * This check is known to work on at least CRuby, TruffleRuby and JRuby. * Exceptions show up with `ruby -d`/`$DEBUG == true` and would show for every Net::HTTP instance.
shioimm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for addressing #251.
I read through the discussion in #224 (comment).
Initially, I wasn’t very enthusiastic about referring to Socket.tcp to check the arguments implemented in TCPSocket#initialize. However, considering the points raised in the discussion, it now seems likely that net-http may use Socket.tcp instead of TCPSocket.open in the future, so I’m beginning to think this direction seems reasonable.
|
Thanks for the review. I think regardless of it, it's good to merge this PR soon and we can remove the slight duplication later on, because having the constant in net-protocol needs a release there, more coordination, and feels more risky. |
|
Why does JRuby hang with the original code? It looks like the original code doesn't have any major issue. Shouldn't this be treated as a JRuby bug, rather than net-http gem? I don't think we need to worry about |
|
For the hanging issue (#251), I also believe that there is something to be fixed on the JRuby side. For net-protocol, I agree with @eregon's standpoints in #252 (comment). If things are fixable within net-http, it'd be better to do so, at least as the first action. |
|
I found that in JRuby’s implementation, it seems that arguments other than |
TBH I did this change because I think the FWIW it seems JRuby does raise an ArgumentError for: |
It has, an exception per Net::HTTP instance is a significant overhead, even more so on non-CRuby where getting a backtrace is more expensive. |
ruby -d/$DEBUG == trueand would show for every Net::HTTP instance.cc @osyoyu