# Logstash crashes at startup when custom codec is used in the config

**URL:** <https://discuss.elastic.co/t/logstash-crashes-at-startup-when-custom-codec-is-used-in-the-config/285078>\
**Category:** Logstash\
**Created:** [September 24, 2021, 11:53am UTC](https://discuss.elastic.co/t/logstash-crashes-at-startup-when-custom-codec-is-used-in-the-config/285078 "2021-09-24T11:53:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rara](https://avatars.discourse-cdn.com/v4/letter/r/ee7513/32.png) [@Rara](https://discuss.elastic.co/u/Rara)\
**Post date:** [September 24, 2021, 11:53am UTC](https://discuss.elastic.co/t/logstash-crashes-at-startup-when-custom-codec-is-used-in-the-config/285078/1 "2021-09-24T11:53:42Z")

</div>

Hi Team

I'm participating in the migration of a project from Logstash 6.4.3 to Logstash 7.10.2. The problem is that the new Logstash crashes at startup when one of our custom codecs is used in the configuration.

The error from the `logstash-plain.log` (formatted for readability):

```auto
Failed to execute action {
  :action=>LogStash::PipelineAction::Create/pipeline_id:main,
  :exception=>"Java::JavaLang::IllegalStateException",
  :message=>"Unable to configure plugins: Missing Converter handling for full class name=org.jruby.gen.u20, simple name=RubyObject20",
  :backtrace=>["org.logstash.config.ir.CompiledPipeline.<init>(CompiledPipeline.java:119)",
  "org.logstash.execution.JavaBasePipelineExt.initialize(JavaBasePipelineExt.java:83)",
  "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.instructions.InstanceSuperInstr.interpret(InstanceSuperInstr.java:84)",
  "org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:361)",
  "org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:72)",
  "org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:86)",
  "org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:73)",
  "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.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:332)",
  "org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:86)",
  "org.jruby.ir.instructions.CallBase.interpret(CallBase.java:549)",
  "org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:361)",
  "org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:72)",
  "org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:92)",
  "org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:191)",
  "org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:178)",
  "org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:208)",
  "org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:396)",
  "org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:205)",
  "org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:325)",
  "org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:72)",
  "org.jruby.ir.interpreter.Interpreter.INTERPRET_BLOCK(Interpreter.java:116)",
  "org.jruby.runtime.MixedModeIRBlockBody.commonYieldPath(MixedModeIRBlockBody.java:137)",
  "org.jruby.runtime.IRBlockBody.call(IRBlockBody.java:60)",
  "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)"]
}

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'",
  "/opt/logstash/logstash-core/lib/logstash/agent.rb:378:in `block in converge_state'"]
}

```

Here is a minimal Logstash config with which I was able to reproduce the issue:

```auto
input {
  file {
    path => ["/var/log/logstash/chain-input.txt"]
    codec => "json"
  }
}

output {
  file {
    path => "/var/log/logstash/chain-output.log"
    codec => chain {
      codec0 => json {}
    }
  }
}

```

As you can see the config uses "chain" codec which is developed internally in the company where I work. It was implemented 5 years ago and was working with previous Logstash versions (2..6) without problems.

How can I dig deeper into the issue? How to find out the line in the codec which causes the issue?

Or maybe it is a problem with Logstash or JRuby? How can I confirm it?

---

<div class="post-metadata">

**Author:** ![Rara](https://avatars.discourse-cdn.com/v4/letter/r/ee7513/32.png) [@Rara](https://discuss.elastic.co/u/Rara)\
**Post date:** [September 28, 2021, 2:23pm UTC](https://discuss.elastic.co/t/logstash-crashes-at-startup-when-custom-codec-is-used-in-the-config/285078/2 "2021-09-28T14:23:45Z")

</div>

I've discovered that if I run Logstash with the parameter `--java-execution false` then it starts successfully with the same configuration. Which leads me to a conclusion that it is a Logstash issue. Any thoughts or suggestions?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 26, 2021, 2:24pm UTC](https://discuss.elastic.co/t/logstash-crashes-at-startup-when-custom-codec-is-used-in-the-config/285078/3 "2021-10-26T14:24:18Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
