Logstash not working with jdk 11.0.16

Hi,

Version details:
Logstash - logstash-oss:7.17.3
OS: centos7
java version: java-11-openjdk-11.0.16.0.8

Background: On a centos-based docker image, I install java, followed by the logstash-oss rpm and use this in kubernetes deployments to run logstash.
With java-11-openjdk-11.0.15.0.9, this has worked fine.

Issue:
But when used with java-11-openjdk-11.0.16.0.8, the docker image build fails with warnings in logstash rpm installation and then errors in logstash plugin installations.

23:20:42  + buildah run --isolation chroot centos-nano-working-container -- rpm -Uvh /tmp/logstash-oss-7.17.3-x86_64.rpm
23:20:42  warning: /tmp/logstash-oss-7.17.3-x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID d88e42b4: NOKEY
23:20:42  Preparing...                          ########################################
23:20:43  Updating / installing...
23:20:49  logstash-oss-1:7.17.3-1               ########################################
23:20:49  Using JAVA_HOME defined java: /etc/alternatives/jre_openjdk/
23:20:49  WARNING: Using JAVA_HOME while Logstash distribution comes with a bundled JDK.
23:20:49  DEPRECATION: The use of JAVA_HOME is now deprecated and will be removed starting from 8.0. Please configure LS_JAVA_HOME instead.
23:20:49  Using provided startup.options file: /etc/logstash/startup.options
23:20:50  WARNING: Unknown module: org.jruby.dist specified to --add-opens
23:20:50  WARNING: Unknown module: org.jruby.dist specified to --add-opens
23:20:50  WARNING: Unknown module: org.jruby.dist specified to --add-opens
23:20:50  WARNING: Unknown module: org.jruby.dist specified to --add-opens
23:20:50  Error: Could not find or load main class [0.001s][warning][os,container]
23:20:50  Caused by: java.lang.ClassNotFoundException: [0/001s][warning][os,container]
23:20:50  /usr/share/logstash/bin/system-install: line 88: [0.001s][warning][os,container]: command not found
23:20:50  Unable to install system startup script for Logstash.
23:20:50  chmod: cannot access '/etc/default/logstash': No such file or directory
23:20:50  warning: %post(logstash-oss-1:7.17.3-1.x86_64) scriptlet failed, exit status 1
23:20:51  + buildah run --isolation chroot centos-working-container -- /usr/share/logstash/bin/logstash-plugin uninstall logstash-output-elasticsearch
23:20:52  Using JAVA_HOME defined java: /etc/alternatives/jre_openjdk/
23:20:52  WARNING: Using JAVA_HOME while Logstash distribution comes with a bundled JDK.
23:20:52  DEPRECATION: The use of JAVA_HOME is now deprecated and will be removed starting from 8.0. Please configure LS_JAVA_HOME instead.
23:20:52  [0.001s][warning][os,container] Duplicate cpuset controllers detected. Picking /sys/fs/cgroup/cpuset, skipping /sys/fs/cgroup/cpuset.
23:20:52  [0.001s][warning][os,container] Duplicate cpuset controllers detected. Picking /sys/fs/cgroup/cpuset, skipping /sys/fs/cgroup/cpuset.
23:20:52  [0.001s][warning][os,container] Duplicate cpuset controllers detected. Picking /sys/fs/cgroup/cpuset, skipping /sys/fs/cgroup/cpuset.
23:20:52  WARNING: Unknown module: org.jruby.dist specified to --add-opens
23:20:52  WARNING: Unknown module: org.jruby.dist specified to --add-opens
23:20:52  WARNING: Unknown module: org.jruby.dist specified to --add-opens
23:20:52  WARNING: Unknown module: org.jruby.dist specified to --add-opens
23:20:52  Error: Could not find or load main class [0.001s][warning][os,container]
23:20:52  Caused by: java.lang.ClassNotFoundException: [0/001s][warning][os,container]
23:20:52  subprocess exited with status 1
23:20:52  subprocess exited with status 1
23:20:52  make[1]: *** [build] Error 1
23:20:52  make[1]: Leaving directory `/home/jenkins/workspace/CTO/CSF/Analytics/CSF-BELK-DOCKER_CI/ofd/l'
23:20:52  make: *** [build] Error 1

The same code base works fine with java-11.0.15. Can you help us understand what is causing this issue and how to resolve this?
Does logstash not support java 11.0.16?

Per the official Support Matrix here looks like 15 and 17...

Oracle/OpenJDK*/AdoptOpenJDK 15
Oracle/OpenJDK*/Temurin 17

Not sure why 16 skipped... perhaps someone else can answer that.

Hi @stephenb
Just to clarify - I am referring to java 11 only and not java 15 or 17.
I am facing an issue with java 11.0.16 which is just a patch update on java 11.0.15. So it shouldnt have major changes and hence the concern with why 11.0.16 is not working..
This stops me from consuming latest patches of java 11.

Can anyone help in answering that?

1 Like

apologies I miss-read

Hi @shivani_aggarwal

Ok I did a quick test I used CentoOS 7, the jdk you specified and the 7.17.3 oss logstash tar.gz not the rpm.... but it looks good... see below.

I suspect their is perhaps a different issue I see here like your LS_JAVA_HOME is not pointed correctly or perhaps this or this

23:20:50 chmod: cannot access '/etc/default/logstash': No such file or directory

Perhaps @Badger might have an Idea.. I am not much of a dockerfile guru for logstash I also see this

CentOS 7 Test

$ cat /etc/centos-release 
CentOS Linux release 7.9.2009 (Core)

$ sudo yum install java-11-openjdk-11.0.16.0.8

$ java -version
openjdk version "11.0.16" 2022-07-19 LTS
OpenJDK Runtime Environment (Red_Hat-11.0.16.0.8-1.el7_9) (build 11.0.16+8-LTS)
OpenJDK 64-Bit Server VM (Red_Hat-11.0.16.0.8-1.el7_9) (build 11.0.16+8-LTS, mixed mode, sharing

$ curl -O https://artifacts.elastic.co/downloads/logstash/logstash-oss-7.17.3-linux-x86_64.tar.gz

$ tar -xvf logstash-oss-7.17.3-linux-x86_64.tar.gz 

$ cd logstash-7.17.3/

$ export LS_JAVA_HOME=/etc/alternatives/jre_11_openjdk

$ ./bin/logstash -f config/logstash-sample.conf 
WARNING: Using LS_JAVA_HOME while Logstash distribution comes with a bundled JDK.
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
Sending Logstash logs to /home/sbrown/logstash-7.17.3/logs which is now configured via log4j2.properties
[2022-09-26T17:19:47,907][INFO ][logstash.runner          ] Log4j configuration path used is: /home/sbrown/logstash-7.17.3/config/log4j2.properties
[2022-09-26T17:19:47,922][INFO ][logstash.runner          ] Starting Logstash {"logstash.version"=>"7.17.3", "jruby.version"=>"jruby 9.2.20.1 (2.5.8) 2021-11-30 2a2962fbd1 OpenJDK 64-Bit Server VM 11.0.16+8-LTS on 11.0.16+8-LTS +indy +jit [linux-x86_64]"}
[2022-09-26T17:19:47,926][INFO ][logstash.runner          ] JVM bootstrap flags: [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djruby.compile.invokedynamic=true, -Djruby.jit.threshold=0, -Djruby.regexp.interruptible=true, -XX:+HeapDumpOnOutOfMemoryError, -Djava.security.egd=file:/dev/urandom, -Dlog4j2.isThreadContextMapInheritable=true]
...
[2022-09-26T17:19:54,966][INFO ][logstash.agent           ] Pipelines running {:count=>1, :running_pipelines=>[:main], :non_running_pipelines=>[]}
[2022-09-26T17:19:55,157][INFO ][org.logstash.beats.Server][main][5237448ed2f0ac4548d75dd974c41e3cad2173b2c69b70448dadf43fa9fe28e0] Starting server on port: 5044

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