Why am I getting IO :: EAGAINWaitReadable with HTTParty?

Bugsnag reports that an exception IO::EAGAINWaitReadablein production is occasionally excluded .

IO::EAGAINWaitReadable: Resource temporarily unavailable - read would block

An exception occurs in an HTTP request through HTTParty, which ultimately results net/protocol.rb:153:in read_nonblockin Ruby 2.1.3.

Why am I getting IO::EAGAINWaitReadable? Why are HTTP requests blocked sometimes? And why not let them block that deal?

+4
source share
1 answer

The most common processing method IO::EAGAINWaitReadable:

begin
   result = io.read_nonblock(maxlen)
rescue IO::EAGAINWaitReadable
   IO.select([io])
   retry
end

So you can do this without choosing a port, but better with a choice, as shown in the example. You can also see the SO answer on how to catch in WaitReadableaddition to the specified.

0

All Articles