A platform for community discussion. Free, open, simple.
DEV: Suppress Pitchfork's "Unexpected message in sig_queue" (#39985)
Jarek Radosz34d738b8ed9f
diff --git a/config/pitchfork.conf.rb b/config/pitchfork.conf.rbindex fd33be97d70..51a50b95a2f 100644--- a/config/pitchfork.conf.rb+++ b/config/pitchfork.conf.rb@@ -159,4 +159,5 @@ if RUBY_PLATFORM.include?("darwin") && ENV["RAILS_ENV"] != "production"# macOS doesn't support the default :SOCK_SEQPACKET# So we override it to avoid the warningPitchfork.instance_variable_set(:@socket_type, :SOCK_STREAM)+ require_relative "../lib/freedom_patches/pitchfork_sock_stream"enddiff --git a/lib/freedom_patches/pitchfork_sock_stream.rb b/lib/freedom_patches/pitchfork_sock_stream.rbnew file mode 100644index 00000000000..44b56f84836--- /dev/null+++ b/lib/freedom_patches/pitchfork_sock_stream.rb@@ -0,0 +1,22 @@+# frozen_string_literal: true++return unless defined?(Pitchfork::HttpServer)++# Pitchfork's monitor wakeup is a single-byte NOOP ("."). Coalesced reads+# like "..." aren't recognized and get logged as unexpected — treat any+# all-dots read as a NOOP.+module PitchforkSockStreamPatch+ def monitor_sleep(sec)+ @control_socket[0].wait(sec) or return+ case message = @control_socket[0].recvmsg_nonblock(exception: false)+ when :wait_readable+ nil+ when String+ @sig_queue << message unless message.match?(/\A\.+\z/)+ else+ @sig_queue << message+ end+ end+end++Pitchfork::HttpServer.prepend(PitchforkSockStreamPatch)