From 1f05bd60102419d12733afa267d96524ece8e756 Mon Sep 17 00:00:00 2001 From: Ivy Evans Date: Tue, 12 Oct 2021 17:14:55 -0700 Subject: [PATCH] Fix `Uncaught exception: can't dump IO` (#5022) --- lib/sidekiq/redis_connection.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/sidekiq/redis_connection.rb b/lib/sidekiq/redis_connection.rb index 89728383e..d44f0b872 100644 --- a/lib/sidekiq/redis_connection.rb +++ b/lib/sidekiq/redis_connection.rb @@ -94,12 +94,10 @@ def client_opts(options) def log_info(options) redacted = "REDACTED" - # deep clone so we can muck with these options all we want - # - # exclude SSL params from dump-and-load because some information isn't - # safely dumpable in current Rubies - keys = options.keys - keys.delete(:ssl_params) + # Deep clone so we can muck with these options all we want and exclude + # params from dump-and-load that may contain objects that Marshal is + # unable to safely dump. + keys = options.keys - [:logger, :ssl_params] scrubbed_options = Marshal.load(Marshal.dump(options.slice(*keys))) if scrubbed_options[:url] && (uri = URI.parse(scrubbed_options[:url])) && uri.password uri.password = redacted