Logstash fails with "FFI not available" message when starting logstash on Centos 7.9

1. Logstash version (e.g. bin/logstash --version) - 8.10.2
**2. Logstash installation source ** - RPM
**3. How is Logstash being run ** - systemd

JVM - tried both the bundled JVM (openjdk version "17.0.8" 2023-07-18)
as well as OpenJDK 11

OS version (uname -a if on a Unix-like system):
Linux - 3.10.0-1160.92.1.el7.x86_64 #1 SMP Tue Jun 20 11:48:01 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Output of ldd --version
ldd (GNU libc) 2.17

Contents of /etc/redhat-release :
CentOS Linux release 7.9.2009 (Core)

Description of the problem:
Logstash fails when starting the service with the basic configuration, with the message below. This is similar to the issue described here: Logstash fails to start on OracleLinux7 · Issue #14873 · elastic/logstash · GitHub

This occurs on a virtual machine installed locally. I've attempted the same on AWS with a CentOS 7.9 AMI (ami-0aedf6b1cb669b4c7) and could not reproduce the issue.
Only difference I found between the machines is that uname -a has a somewhat different output:
Linux ip-xxx-xxx-xxx-xxx.ec2.internal 3.10.0-1160.80.1.el7.x86_64 #1 SMP Tue Nov 8 15:48:59 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Logstash has full permissions for the tmpdir.

[INFO ][logstash.runner          ] Starting Logstash {"logstash.version"=>"8.10.2", "jruby.version"=>"jruby 9.4.2.0 (3.1.0) 2023-03-08 90d2913fda OpenJDK 64-Bit Server VM 17.0.8+7 on 17.0.8+7 +indy +jit [x86_64-linux]"}
[INFO ][logstash.runner          ] JVM bootstrap flags: [-Xms1g, -Xmx1g, -Djava.io.tmpdir=$HOME, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djruby.compile.invokedynamic=true, -XX:+HeapDumpOnOutOfMemoryError, -Djava.security.egd=file:/dev/urandom, -Dlog4j2.isThreadContextMapInheritable=true, -Djruby.native.verbose=true, -Djruby.regexp.interruptible=true, -Djdk.io.File.enableADS=true, --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED, --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED, --add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED, --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED, --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED, --add-opens=java.base/java.security=ALL-UNNAMED, --add-opens=java.base/java.io=ALL-UNNAMED, --add-opens=java.base/java.nio.channels=ALL-UNNAMED, --add-opens=java.base/sun.nio.ch=ALL-UNNAMED, --add-opens=java.management/sun.management=ALL-UNNAMED]
[2023-10-10T12:39:46,289][FATAL][org.logstash.Logstash    ] Logstash stopped processing because of an error: (LoadError) Could not load FFI Provider: (NotImplementedError) FFI not available: null
 See http://jira.codehaus.org/browse/JRUBY-4583
org.jruby.exceptions.LoadError: (LoadError) Could not load FFI Provider: (NotImplementedError) FFI not available: null
 See http://jira.codehaus.org/browse/JRUBY-4583
	at org.jruby.ext.jruby.JRubyUtilLibrary.load_ext(org/jruby/ext/jruby/JRubyUtilLibrary.java:216) ~[jruby.jar:?]
	at RUBY.<main>(/usr/share/logstash/vendor/bundle/jruby/3.1.0/gems/ffi-1.15.5-java/lib/ffi.rb:11) ~[?:?]
	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1057) ~[jruby.jar:?]
	at RUBY.<module:LibC>(/usr/share/logstash/logstash-core/lib/logstash/util/prctl.rb:19) ~[?:?]
	at RUBY.<main>(/usr/share/logstash/logstash-core/lib/logstash/util/prctl.rb:18) ~[?:?]
	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1057) ~[jruby.jar:?]
	at RUBY.set_thread_name(/usr/share/logstash/logstash-core/lib/logstash/util.rb:36) ~[?:?]
	at RUBY.execute(/usr/share/logstash/logstash-core/lib/logstash/runner.rb:365) ~[?:?]
	at RUBY.run(/usr/share/logstash/vendor/bundle/jruby/3.1.0/gems/clamp-1.0.1/lib/clamp/command.rb:68) ~[?:?]
	at RUBY.run(/usr/share/logstash/logstash-core/lib/logstash/runner.rb:287) ~[?:?]
	at RUBY.run(/usr/share/logstash/vendor/bundle/jruby/3.1.0/gems/clamp-1.0.1/lib/clamp/command.rb:133) ~[?:?]
	at usr.share.logstash.lib.bootstrap.environment.<main>(/usr/share/logstash/lib/bootstrap/environment.rb:89) ~[?:?]
Caused by: org.jruby.exceptions.NotImplementedError: (NotImplementedError) FFI not available: null

Check this and, as Leandro recommended, change tmp path in jvm.options.
-Djava.io.tmpdir=/opt/logstash_tmp or any other directory on which logstash user has write rights.

It was the parent folder of tmpdir. Thanks!

1 Like

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