Skip to content

Commit

Permalink
Backport PR #13447 to 8.0: Fix: patch Puma around a JRuby ARM64 bug (#…
Browse files Browse the repository at this point in the history
…13453)

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
(cherry picked from commit 32690cb)
  • Loading branch information
kares authored Nov 30, 2021
1 parent 93f7da5 commit 6937139
Showing 1 changed file with 16 additions and 0 deletions.
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!
if ENV_JAVA['os.name'].match?(/Linux/i) && ENV_JAVA['os.arch'].eql?('aarch64')
Puma::Server.class_eval do
def closed_socket?(socket)
false
end
end
end

0 comments on commit 6937139

Please sign in to comment.