Thanks to visit codestin.com
Credit goes to github.com

Skip to content

v0.94.0 regression: bignum too big to convert into `long' (RangeError) #800

@landongrindheim

Description

@landongrindheim

🖼️ Context

My team recently upgraded from v0.93.1 to v0.94.0 and began experiencing errors being raised when making requests. This hasn't been happening on every request. It has been happening sporadically enough that it took a couple weeks to identify Excon as the source of the error. After reverting to use v0.93.1 we are no longer experiencing any issues.

📝 Notes

I looked through the commits that make up the changes for v0.94.0 and noticed that, as of 7ac3568, max_length is handled differently in Socket#read_nonblock. This value (max_length) is later given to String#slice!, which raises the error we've been experiencing. While it seems likely, I haven't determined for certain that this is the cause of the regression.

Before:

        if max_length
           until @read_buffer.length >= max_length
             @read_buffer << @socket.read_nonblock(max_length - @read_buffer.length)
           end

After:

       while !@backend_eof && (!max_length || @read_buffer.length < max_length)
           @read_buffer << @socket.read_nonblock(@data[:chunk_size])

🔎 Stack trace

Excon::Error::Socket: bignum too big to convert into `long' (RangeError)
  from /usr/local/bundle/gems/excon-0.94.0/lib/excon/socket.rb:221:in `slice!'
  from /usr/local/bundle/gems/excon-0.94.0/lib/excon/socket.rb:221:in `read_nonblock'
  from /usr/local/bundle/gems/excon-0.94.0/lib/excon/socket.rb:58:in `read'
  from /usr/local/bundle/gems/excon-0.94.0/lib/excon/response.rb:133:in `parse'
  from /usr/local/bundle/gems/excon-0.94.0/lib/excon/middlewares/response_parser.rb:7:in `response_call'
  from /usr/local/bundle/gems/excon-0.94.0/lib/excon/connection.rb:456:in `response'
  from /usr/local/bundle/gems/excon-0.94.0/lib/excon/connection.rb:287:in `request'
  from /usr/local/bundle/gems/excon-0.94.0/lib/excon/middlewares/idempotent.rb:50:in `error_call'
  from /usr/local/bundle/gems/excon-0.94.0/lib/excon/middlewares/base.rb:17:in `error_call'
  from /usr/local/bundle/gems/excon-0.94.0/lib/excon/middlewares/base.rb:17:in `error_call'
  from /usr/local/bundle/gems/excon-0.94.0/lib/excon/connection.rb:312:in `rescue in request'
  from /usr/local/bundle/gems/excon-0.94.0/lib/excon/connection.rb:227:in `request'
  from /usr/local/bundle/gems/excon-0.94.0/lib/excon/middlewares/idempotent.rb:50:in `error_call'
  from /usr/local/bundle/gems/excon-0.94.0/lib/excon/middlewares/base.rb:17:in `error_call'
  from /usr/local/bundle/gems/excon-0.94.0/lib/excon/middlewares/base.rb:17:in `error_call'
  from /usr/local/bundle/gems/excon-0.94.0/lib/excon/connection.rb:312:in `rescue in request'
  from /usr/local/bundle/gems/excon-0.94.0/lib/excon/connection.rb:227:in `request'
  from /usr/local/bundle/gems/excon-0.94.0/lib/excon.rb:250:in `get'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions