Skip to content

Unquoted number for url name causes Logstash to crash #123

@n0othing

Description

@n0othing

Version: 7.8.0

Specifying an unquoted number as a URL name causes Logstash to crash. The following config:

input {
  http_poller {
  urls => { 1 => "http://svc.metrotransit.org/NexTrip/VehicleLocations/5?format=json" }
  request_timeout => 60
  schedule => { cron => "* * * * * UTC"}
  codec => "json"
  }
}

output {
  stdout { codec => rubydebug }
}

Causes Logstash to throw the following error:

logstash-7.8.0 bin/logstash -f logstash.conf
Sending Logstash logs to /Users/robbie/elastic/7.8_logstash_http_poller/logstash-7.8.0/logs which is now configured via log4j2.properties
[2020-06-23T11:29:34,379][WARN ][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified
[2020-06-23T11:29:34,495][INFO ][logstash.runner          ] Starting Logstash {"logstash.version"=>"7.8.0", "jruby.version"=>"jruby 9.2.11.1 (2.5.7) 2020-03-25 b1f55b1a40 Java HotSpot(TM) 64-Bit Server VM 25.181-b13 on 1.8.0_181-b13 +indy +jit [darwin-x86_64]"}
[2020-06-23T11:29:36,137][INFO ][org.reflections.Reflections] Reflections took 38 ms to scan 1 urls, producing 21 keys and 41 values 
[2020-06-23T11:29:36,321][ERROR][logstash.agent           ] Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main, :exception=>"Java::JavaLang::IllegalStateException", :message=>"Unable to configure plugins: (RuntimeError) can't add a new key into hash during iteration", :backtrace=>["org.logstash.config.ir.CompiledPipeline.<init>(CompiledPipeline.java:119)", "org.logstash.execution.JavaBasePipelineExt.initialize(JavaBasePipelineExt.java:80)", "org.logstash.execution.JavaBasePipelineExt$INVOKER$i$1$0$initialize.call(JavaBasePipelineExt$INVOKER$i$1$0$initialize.gen)", "org.jruby.internal.runtime.methods.JavaMethod$JavaMethodN.call(JavaMethod.java:837)", "org.jruby.ir.runtime.IRRuntimeHelpers.instanceSuper(IRRuntimeHelpers.java:1169)", "org.jruby.ir.runtime.IRRuntimeHelpers.instanceSuperSplatArgs(IRRuntimeHelpers.java:1156)", "org.jruby.ir.targets.InstanceSuperInvokeSite.invoke(InstanceSuperInvokeSite.java:39)", "Users.robbie.elastic.$7_dot_8_logstash_http_poller.logstash_minus_7_dot_8_dot_0.logstash_minus_core.lib.logstash.java_pipeline.RUBY$method$initialize$0(/Users/robbie/elastic/7.8_logstash_http_poller/logstash-7.8.0/logstash-core/lib/logstash/java_pipeline.rb:43)", "org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:82)", "org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:70)", "org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:332)", "org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:86)", "org.jruby.RubyClass.newInstance(RubyClass.java:939)", "org.jruby.RubyClass$INVOKER$i$newInstance.call(RubyClass$INVOKER$i$newInstance.gen)", "org.jruby.ir.targets.InvokeSite.invoke(InvokeSite.java:207)", "Users.robbie.elastic.$7_dot_8_logstash_http_poller.logstash_minus_7_dot_8_dot_0.logstash_minus_core.lib.logstash.pipeline_action.create.RUBY$method$execute$0(/Users/robbie/elastic/7.8_logstash_http_poller/logstash-7.8.0/logstash-core/lib/logstash/pipeline_action/create.rb:52)", "Users.robbie.elastic.$7_dot_8_logstash_http_poller.logstash_minus_7_dot_8_dot_0.logstash_minus_core.lib.logstash.pipeline_action.create.RUBY$method$execute$0$__VARARGS__(/Users/robbie/elastic/7.8_logstash_http_poller/logstash-7.8.0/logstash-core/lib/logstash/pipeline_action/create.rb)", "org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:82)", "org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:70)", "org.jruby.ir.targets.InvokeSite.invoke(InvokeSite.java:207)", "Users.robbie.elastic.$7_dot_8_logstash_http_poller.logstash_minus_7_dot_8_dot_0.logstash_minus_core.lib.logstash.agent.RUBY$block$converge_state$2(/Users/robbie/elastic/7.8_logstash_http_poller/logstash-7.8.0/logstash-core/lib/logstash/agent.rb:342)", "org.jruby.runtime.CompiledIRBlockBody.callDirect(CompiledIRBlockBody.java:138)", "org.jruby.runtime.IRBlockBody.call(IRBlockBody.java:58)", "org.jruby.runtime.IRBlockBody.call(IRBlockBody.java:52)", "org.jruby.runtime.Block.call(Block.java:139)", "org.jruby.RubyProc.call(RubyProc.java:318)", "org.jruby.internal.runtime.RubyRunnable.run(RubyRunnable.java:105)", "java.lang.Thread.run(Thread.java:748)"]}
warning: thread "Converge PipelineAction::Create<main>" terminated with exception (report_on_exception is true):
LogStash::Error: Don't know how to handle `Java::JavaLang::IllegalStateException` for `PipelineAction::Create<main>`
          create at org/logstash/execution/ConvergeResultExt.java:129
             add at org/logstash/execution/ConvergeResultExt.java:57
  converge_state at /Users/robbie/elastic/7.8_logstash_http_poller/logstash-7.8.0/logstash-core/lib/logstash/agent.rb:355
[2020-06-23T11:29:36,331][ERROR][logstash.agent           ] An exception happened when converging configuration {:exception=>LogStash::Error, :message=>"Don't know how to handle `Java::JavaLang::IllegalStateException` for `PipelineAction::Create<main>`", :backtrace=>["org/logstash/execution/ConvergeResultExt.java:129:in `create'", "org/logstash/execution/ConvergeResultExt.java:57:in `add'", "/Users/robbie/elastic/7.8_logstash_http_poller/logstash-7.8.0/logstash-core/lib/logstash/agent.rb:355:in `block in converge_state'"]}
[2020-06-23T11:29:36,367][FATAL][logstash.runner          ] An unexpected error occurred! {:error=>#<LogStash::Error: Don't know how to handle `Java::JavaLang::IllegalStateException` for `PipelineAction::Create<main>`>, :backtrace=>["org/logstash/execution/ConvergeResultExt.java:129:in `create'", "org/logstash/execution/ConvergeResultExt.java:57:in `add'", "/Users/robbie/elastic/7.8_logstash_http_poller/logstash-7.8.0/logstash-core/lib/logstash/agent.rb:355:in `block in converge_state'"]}
[2020-06-23T11:29:36,387][ERROR][org.logstash.Logstash    ] java.lang.IllegalStateException: Logstash stopped processing because of an error: (SystemExit) exit

This doesn't happen if the number is quoted (e.g "1"). Unquoted strings (e.g myurl) seem to work fine too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions