Mohamed Hafez <mohamed.m.m.hafez / gmail.com> wrote:
> On Mon, May 30, 2016 at 9:18 AM, Mohamed Hafez <mohamed.m.m.hafez / gmail.com>
> wrote:
> 
> > Hi all, every now and then in my production server, I'm
> > getting Errno::EAGAIN errors thrown by by
> > OpenSSL::SSL::SSLSocket#connect_nonblock from at
> > https://github.com/ruby/ruby/blob/trunk/lib/net/http.rb#L938
> >
> > I'm using JRuby, so initially I assumed it was just a JRuby implementation
> > bug and that MRI's  OpenSSL::SSL::SSLSocket#connect_nonblock must
> > handle Errno::EAGAIN internally, but now that I think about it, the only
> > way to handle Errno::EAGAIN is to wait for a bit and then retry, and
> > connect_nonblock isn't supposed to block so how would it do that....
>
> Or does MRI's  OpenSSL::SSL::SSLSocket#connect_nonblock just return
> :wait_writable
> in this case, since from my understanding this error gets thrown when the
> tcp write buffer is full?

(top-posting corrected)

Yes, connect_nonblock(exception: false) should not raise for
EAGAIN or Wait*, it should return :wait_* symbol

JRuby needs to implement `exception: false' support which was
added in MRI 2.3

Sorry I could not add that to rubyspec, rubyspec requires
using a proprietary messaging system/workflow to contribute.

> > Since this only happens once in a while in production, I don't actually
> > have a way of seeing if MRI Ruby will also throw this error, but I can't
> > see how it wouldn't if connect_nonblock can't block for a while before
> > retrying, but let me know if I'm wrong. If I am correct, could I submit a
> > pull request to catch Errno::EAGAIN at
> > https://github.com/ruby/ruby/blob/trunk/lib/net/http.rb#L938 and then
> > retry?

No, this should be fixed in other Ruby implementations for 2.3
compatibility.

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>