Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: patch Puma around a JRuby ARM64 bug #13447

Merged
merged 5 commits into from
Nov 25, 2021
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions logstash-core/lib/logstash/patches/puma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,19 @@ module Puma
STDERR = LogStash::IOWrappedLogger.new(LogStash::NullLogger)
STDOUT = LogStash::IOWrappedLogger.new(LogStash::NullLogger)
end

# JRuby (>= 9.2.18.0) added support for getsockopt(Socket::IPPROTO_TCP, Socket::TCP_INFO)
# however it isn't working correctly on ARM64 likely due an underlying issue in JNR/JFFI.
#
# Puma uses the TCP_INFO to detect a closed socket when handling a request and has a dummy
# fallback in place when Socket constants :TCP_INFO && :IPPROTO_TCP are not defined, see:
# https://github.com/puma/puma/blob/v5.5.2/lib/puma/server.rb#L169-L192
#
# Remove this patch once https://github.com/elastic/logstash/issues/13444 gets resolved!
Puma::Server.class_eval do
if closed_socket_supported? && ENV_JAVA['os.name'].match?(/Linux/i) && ENV_JAVA['os.arch'].eql?('aarch64')
def closed_socket?(socket)
false
end
end
end
kares marked this conversation as resolved.
Show resolved Hide resolved