scout_apm net/http instrumentation breaks fastimage?
fschwahn opened this issue · comments
We have been using fastimage
for years without issue. We added scout_apm
on Friday to our app and are seeing the following errors occasionally: NoMethodError: undefined method
size' for #Net::ReadAdapter`
Looking at the stacktrace, I see that scout_apm
has injected itself here. As this has run for years without issue, and this was an isolated deploy where we only added scout_apm
, I have a strong suspicion that somehow the scout_apm
-gem is responsible.
File "/app/vendor/bundle/ruby/3.2.0/gems/fastimage-2.3.0/lib/fastimage.rb", line 516, in skip
File "/app/vendor/bundle/ruby/3.2.0/gems/fastimage-2.3.0/lib/fastimage.rb", line 877, in block in parse_size_for_jpeg
File "/app/vendor/bundle/ruby/3.2.0/gems/fastimage-2.3.0/lib/fastimage.rb", line 847, in loop
File "/app/vendor/bundle/ruby/3.2.0/gems/fastimage-2.3.0/lib/fastimage.rb", line 847, in parse_size_for_jpeg
File "/app/vendor/bundle/ruby/3.2.0/gems/fastimage-2.3.0/lib/fastimage.rb", line 434, in parse_size
File "/app/vendor/bundle/ruby/3.2.0/gems/fastimage-2.3.0/lib/fastimage.rb", line 414, in parse_packets
File "/app/vendor/bundle/ruby/3.2.0/gems/fastimage-2.3.0/lib/fastimage.rb", line 341, in block in fetch_using_http_from_parsed_uri
File "/app/vendor/ruby-3.2.3/lib/ruby/3.2.0/net/http.rb", line 2353, in block in transport_request
File "/app/vendor/ruby-3.2.3/lib/ruby/3.2.0/net/http/response.rb", line 320, in reading_body
File "/app/vendor/ruby-3.2.3/lib/ruby/3.2.0/net/http.rb", line 2352, in transport_request
File "/app/vendor/ruby-3.2.3/lib/ruby/3.2.0/net/http.rb", line 2306, in request
File "/app/vendor/bundle/ruby/3.2.0/gems/scout_apm-5.3.7/lib/scout_apm/instruments/net_http.rb", line 34, in block in request_with_scout_instruments
File "/app/vendor/bundle/ruby/3.2.0/gems/scout_apm-5.3.7/lib/scout_apm/tracer.rb", line 34, in instrument
File "/app/vendor/bundle/ruby/3.2.0/gems/scout_apm-5.3.7/lib/scout_apm/tracer.rb", line 44, in instrument
File "/app/vendor/bundle/ruby/3.2.0/gems/scout_apm-5.3.7/lib/scout_apm/instruments/net_http.rb", line 33, in request_with_scout_instruments
File "/app/vendor/ruby-3.2.3/lib/ruby/3.2.0/net/http.rb", line 2299, in block in request
File "/app/vendor/ruby-3.2.3/lib/ruby/3.2.0/net/http.rb", line 1570, in start
File "/app/vendor/ruby-3.2.3/lib/ruby/3.2.0/net/http.rb", line 2297, in request
File "/app/vendor/bundle/ruby/3.2.0/gems/scout_apm-5.3.7/lib/scout_apm/instruments/net_http.rb", line 34, in block in request_with_scout_instruments
File "/app/vendor/bundle/ruby/3.2.0/gems/scout_apm-5.3.7/lib/scout_apm/tracer.rb", line 34, in instrument
File "/app/vendor/bundle/ruby/3.2.0/gems/scout_apm-5.3.7/lib/scout_apm/tracer.rb", line 44, in instrument
File "/app/vendor/bundle/ruby/3.2.0/gems/scout_apm-5.3.7/lib/scout_apm/instruments/net_http.rb", line 33, in request_with_scout_instruments
File "/app/vendor/ruby-3.2.3/lib/ruby/3.2.0/net/http.rb", line 2177, in request_get
File "/app/vendor/bundle/ruby/3.2.0/gems/fastimage-2.3.0/lib/fastimage.rb", line 301, in fetch_using_http_from_parsed_uri
File "/app/vendor/bundle/ruby/3.2.0/gems/fastimage-2.3.0/lib/fastimage.rb", line 283, in fetch_using_http
File "/app/vendor/bundle/ruby/3.2.0/gems/fastimage-2.3.0/lib/fastimage.rb", line 249, in initialize
File "/app/vendor/bundle/ruby/3.2.0/gems/fastimage-2.3.0/lib/fastimage.rb", line 143, in new
File "/app/vendor/bundle/ruby/3.2.0/gems/fastimage-2.3.0/lib/fastimage.rb", line 143, in size
So, I disabled scout and this still happens - it seems this was just unlucky timing. Sorry!