In jvm.options file pass kill -9 for killing logstash on outofmemory

Hi,

I wanted to pass -XX:OnOutOfMemoryError=kill -9 %p
option to the JVM arguments of logstash. I added the same in jvm.options file, But once i add it i get:

Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

Please suggest if above option is needed in logstash and what is the format to add it. Should it be escaped or something?

Thank You

Hello @Sunil_Vp

While I would suggest you to investigate why you might get OutOfMemory on Logstash, I think:

  • You can use -XX:+ExitOnOutOfMemoryError
  • You can use -XX:+CrashOnOutOfMemoryError
  • You should be able to use -XX:OnOutOfMemoryError="kill -9 %p"

Some explanations are available here.

At the same time, the typical behavior of Logstash is to stop upon an OutOfMemory, so those parameters shouldn't be necessary.

Thanks a lot Luca for the reply.
I wasn't aware that the default behaviour of logstash is to stop upon OutOfMemory.

We were trying to have a custom java plugin in logstash application, so when i tried to see the jvm arguments kill on outofmemory was missing so wanted a way to add it. Since custom code was added was thinking it was safe to add the above option.

Thanks again in advance.

1 Like

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