janko / down

Streaming downloads using Net::HTTP, http.rb or HTTPX

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Net::ReadTimeout

mvasin opened this issue · comments

I just got alert from bugsnag:

Net::ReadTimeout/usr/lib/ruby/2.3.0/net/protocol.rb:158

/usr/lib/ruby/2.3.0/net/protocol.rb:158rbuf_fill	
/usr/lib/ruby/2.3.0/net/protocol.rb:106read	
/usr/lib/ruby/2.3.0/net/http/response.rb:291block in read_body_0	
/usr/lib/ruby/2.3.0/net/http/response.rb:276inflater	
/usr/lib/ruby/2.3.0/net/http/response.rb:281read_body_0	
/usr/lib/ruby/2.3.0/net/http/response.rb:202read_body	
gems/down-4.0.1/lib/down/chunked_io.rb:154each	
gems/down-4.0.1/lib/down/chunked_io.rb:154block in chunks_fiber	

Looks like Down didn't intercept Net::HTTP's Net::ReadTimeout exception.
I rescue only Down::Error and hope Down will intercept its dependencies' exceptions.

In my code I use Down.open.

@mvasin Can you show me the full stack trace of the error? Does it by any chance originate from lib/down/net_http.rb:175?

It's an IoT project, and currently logs accumulation is limited: I have only last 40 minutes of logs accessible (that's how resin.io works), and now log records regarding the error are gone; I had the error just once, today early in the morning.

The fact that the bugsnag's log stack does not include my app's code is also a little weird.

@mvasin Ok, no problem actually, I know two possible places where this could happen (I just checked the Net::HTTP source code), so I'll just make fixes for both places.

@mvasin I just released version 4.1.0 with the fix.

Salut, @janko-m!

Here's one more Net::HTTP exception creeping in:

Errno::ENETUNREACH: /usr/lib/ruby/2.3.0/net/http.rb:882:in `rescue in block in connect'
Errno::ENETUNREACH: /usr/lib/ruby/2.3.0/net/http.rb:879:in `block in connect'
Errno::ENETUNREACH: /usr/lib/ruby/2.3.0/timeout.rb:91:in `block in timeout'
Errno::ENETUNREACH: /usr/lib/ruby/2.3.0/timeout.rb:101:in `timeout'
Errno::ENETUNREACH: /usr/lib/ruby/2.3.0/net/http.rb:878:in `connect'
Errno::ENETUNREACH: /usr/lib/ruby/2.3.0/net/http.rb:863:in `do_start'
Errno::ENETUNREACH: /usr/lib/ruby/2.3.0/net/http.rb:852:in `start'
Errno::ENETUNREACH: /var/lib/gems/2.3.0/gems/down-4.1.0/lib/down/net_http.rb:152:in `block in open'

It occurs when my IoT thing is offline.

@mvasin I've just released version 4.1.1 with the fix.