elastic / elastic-transport-ruby

Transport classes and utilities shared among Ruby Elastic client libraries
Apache License 2.0
5 stars 19 forks source link

publish_address ipv4 is mis-parsed as ipv6, leading to a undefined nil access and failure #48

Closed robbat2 closed 1 year ago

robbat2 commented 1 year ago
(REDACTED)/vendor/bundle/ruby/2.7.0/gems/elastic-transport-8.2.0/lib/elastic/transport/transport/sniffer.rb:82:in `parse_publish_address': undefined method `[]' for nil:NilClass (NoMethodError)
# curl -s http://localhost:9200/_nodes |jq '.nodes|to_entries|first|.value|.http.publish_address'
"inet[/127.0.0.1:9200]"

This leads to a failure in parse_publish_address

     8: from (REDACTED)/vendor/bundle/ruby/2.7.0/gems/elastic-transport-8.2.0/lib/elastic/transport/transport/base.rb:99:in `reload_connections!'
     7: from (REDACTED)/vendor/bundle/ruby/2.7.0/gems/elastic-transport-8.2.0/lib/elastic/transport/transport/sniffer.rb:46:in `hosts'
     6: from (REDACTED)/vendor/bundle/ruby/2.7.0/gems/timeout-0.3.2/lib/timeout.rb:196:in `timeout'
     5: from (REDACTED)/vendor/bundle/ruby/2.7.0/gems/timeout-0.3.2/lib/timeout.rb:189:in `block in timeout'
     4: from (REDACTED)/vendor/bundle/ruby/2.7.0/gems/elastic-transport-8.2.0/lib/elastic/transport/transport/sniffer.rb:49:in `block in hosts'
     3: from (REDACTED)/vendor/bundle/ruby/2.7.0/gems/elastic-transport-8.2.0/lib/elastic/transport/transport/sniffer.rb:49:in `map'
     2: from (REDACTED)/vendor/bundle/ruby/2.7.0/gems/elastic-transport-8.2.0/lib/elastic/transport/transport/sniffer.rb:49:in `each'
     1: from (REDACTED)/vendor/bundle/ruby/2.7.0/gems/elastic-transport-8.2.0/lib/elastic/transport/transport/sniffer.rb:51:in `block (2 levels) in hosts'
(REDACTED)/vendor/bundle/ruby/2.7.0/gems/elastic-transport-8.2.0/lib/elastic/transport/transport/sniffer.rb:82:in `parse_publish_address': undefined method `[]' for nil:NilClass (NoMethodError)