[ruby-core:70168] [Ruby trunk - Bug #11400] IO.gets(/\x0d?\x0a\x0d?\x0a/, 4096) raises comparison of Fixnum with nil failed

From: bar.hofesh@...
Date: 2015-07-29 08:17:28 UTC
List: ruby-core #70168
Issue #11400 has been updated by Bar Hofesh.


Eric Wong wrote:
> Since you're using SSLSocket, I recommend dumping a backtrace when you
>  rescue since gets is implemented in Ruby in the OpenSSL::Buffering module
>  (ext/openssl/lib/openssl/buffering.rb in the Ruby source)

Error Reading Aware: comparison of Fixnum with nil failed
Error Reading Aware: ["/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/openssl/buffering.rb:217:in `each'", "/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/openssl/buffering.rb:217:in `min'", "/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/openssl/buffering.rb:217:in `gets'", "/opt/Zakif/Core/Core_Http_Aware_Read.rb:10:in `block in read'", "/usr/local/rvm/gems/ruby-2.2.1/gems/webrick-1.3.1/lib/webrick/utils.rb:234:in `timeout'", "/opt/Zakif/Core/Core_Http_Aware_Read.rb:9:in `read'", "/opt/Zakif/Proxies/Proxies_Ldap.rb:169:in `block (2 levels) in tcp_proxy'", "/opt/Zakif/Proxies/Proxies_Ldap.rb:135:in `each'", "/opt/Zakif/Proxies/Proxies_Ldap.rb:135:in `block in tcp_proxy'", "/opt/Zakif/Proxies/Proxies_Ldap.rb:130:in `loop'", "/opt/Zakif/Proxies/Proxies_Ldap.rb:130:in `tcp_proxy'", "/opt/Zakif/Proxies/Proxies_Ldap.rb:410:in `first_data_exchange_after_login'", "/opt/Zakif/Proxies/Proxies_Ldap.rb:234:in `http_login'", "/opt/Zakif/Proxies/Proxies_Ldap.rb:96:in `block (2 levels)
  in main_loop_device'"]

Does this help ? 

----------------------------------------
Bug #11400: IO.gets(/\x0d?\x0a\x0d?\x0a/, 4096) raises comparison of Fixnum with nil failed
https://bugs.ruby-lang.org/issues/11400#change-53597

* Author: Bar Hofesh
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
This is my code, "socket" is a SSLSocket this is why it allows a Regexp in gets

`begin
    http_response[:http_headers] = WEBrick::Utils.timeout(3){
      socket.gets(/\x0d?\x0a\x0d?\x0a/, 4096) #\r?\n\r?\n
    }
  rescue Errno::ECONNRESET
    return nil
  rescue Timeout::Error
    LOGGER_SYSLOG_SYSLOG.syslog_error('e', 'Timeout when reading aware')
  rescue Exception => e
    LOGGER_SYSLOG_SYSLOG.syslog_error('e', "Error Reading Aware: #{e}")
    retry unless socket.eof? || socket.closed?
  end`

The error reads like this: "Error Reading Aware: comparison of Fixnum with nil failed"
Which means it comes from this begin\rescue block, but there is nothing inside it which would compare a Fixnum with nil, so, I suspect that gets does it ? 



-- 
https://bugs.ruby-lang.org/

In This Thread

Prev Next