discourse/lib/freedom_patches
Alan Guo Xiang Tan 23c38cbf11
DEV: Log Unicorn worker timeout backtraces to `Rails.logger` (#27257)
This commit introduces the following changes:

1. Introduce the `SignalTrapLogger` singleton which starts a single
   thread that polls a queue to log messages with the specified logger.
   This thread is necessary becasue most loggers cannot be used inside
   the `Signal.trap` context as they rely on mutexes which are not
   allowed within the context.

2. Moves the monkey patch in `freedom_patches/unicorn_http_server_patch.rb` to
   `config/unicorn.config.rb` which is already monkey patching
   `Unicorn::HttpServer`.

3. `Unicorn::HttpServer` will now automatically send a `USR2` signal to
   a unicorn worker 2 seconds before the worker is timed out by the
   Unicorn master.

4. When a Unicorn worker receives a `USR2` signal, it will now log only
   the main thread's backtraces to `Rails.logger`. Previously, it was
   `put`ing the backtraces to `STDOUT` which most people wouldn't read.
   Logging it via `Rails.logger` will make the backtraces easily
   accessible via `/logs`.
2024-06-03 12:51:12 +08:00
..
active_record_attribute_methods.rb
ams_include_without_root.rb
copy_file.rb
cose_rsapkcs1.rb
fast_pluck.rb
inflector_backport.rb
ip_addr.rb DEV: Fix various rubocop lints (#24749) 2023-12-06 23:25:00 +01:00
mail_disable_starttls.rb
rails4.rb
rails_multisite.rb DEV: Make multisite freedom patch compatible with Rails 7.1+ 2023-05-31 14:29:14 +02:00
safe_buffer.rb
safe_migrations.rb
schema_migration_details.rb
sprockets_patches.rb DEV: Drop workbox dependency (#26735) 2024-04-24 10:19:12 +01:00
translate_accelerator.rb DEV: Update to lastest rubocop-discourse 2024-05-27 18:06:14 +02:00
web_push_request.rb