Uh oh!
There was an error while loading. Please reload this page.
Fix TCP Requester #recv_reply - #105
Conversation
@hsbt I would love to get a review on this |
| raise Errno::ECONNRESET if len_data.nil? | ||
| len = len_data.unpack('n')[0] | ||
| reply = @socks[0].read(len) | ||
| raise Errno::ECONNRESET if reply.nil? |
There was a problem hiding this comment.
While we're at it, could we also fix the cases where len_data.bytesize != 2 and reply.bytesize != len?
Raising Errno::ECONNRESET when it doesn't involve the ECONNRESET errno feels wrong.
There was a problem hiding this comment.
Thanks for the comment! You are right that ECONNRESET was probably not the right exception. I changed it to EOFError which is probably not perfect, but much closer to reality.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
5d37435 to
9c640bdCompareUh oh!
There was an error while loading. Please reload this page.
jsaubry
commented
Jan 29, 2026
@hsbt do you think it would be possible to get a release with this PR? Thank you very much |
I've been seeing some intermittent
NoMethodError undefined method 'unpack' for nilexceptions raised from Resolv.This seems to have been caused by misbehaving DNS servers closing connections before answering. The fix is to simply make sure we were able to read data from the server before trying to interpret it.
The raised
Errno::ECONNRESETwill be caught by the calling#requestmethod and re-raised asResolvTimeout.