unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: "Cédric Carrard" <cedriccarrard@gmail.com>
To: unicorn-public@yhbt.net
Subject: Rails 7 - Unicorn 6.1.0 -- reaped with preload_app
Date: Fri, 6 May 2022 15:55:42 +0200	[thread overview]
Message-ID: <CAOYoJW_=iOgik_wgKJNkvzkKJeu1uxOEW96iHXbr+VR99Rf0wg@mail.gmail.com> (raw)

Hello

Since the update to rails 7 and ruby 3.1.1 I have errors with unicorn
6.1.0 (we use docker-compose, nginx, sidekiq, postgresql and
unicorn-worker-killer).

1:10280 configurator.rb:49] Unicorn -- reaped #<Process::Status: pid
415 exit 1> worker=15

Here is the unicorn configuration:

require 'semantic_logger'

worker_processes(File.read('/proc/cpuinfo').scan(/^processor\s*:/).size
* (ENV['WORKERS_PER_CPU'] || 2).to_i)
timeout 300
preload_app true
listen(ENV["PORT"] || 3000)
logger SemanticLogger['Unicorn']

before_fork do |server, _worker|
  Signal.trap 'TERM' do
    server.logger.info 'Unicorn master intercepting TERM and sending
myself QUIT instead'
    Process.kill 'QUIT', Process.pid
  end

  defined?(ActiveRecord::Base) && ActiveRecord::Base.connection.disconnect!
end

after_fork do |server, _worker|
  Signal.trap 'TERM' do
    server.logger.info 'Unicorn worker intercepting TERM and doing
nothing. Wait for master to send QUIT'
  end

  SemanticLogger.reopen

  defined?(ActiveRecord::Base) && ActiveRecord::Base.establish_connection
end

If I remove the preload_app it works (but apparently it is recommended
to leave this setting)

Do you have any idea where the problem could be?

Thanks for your help

------------------------
Best regards

Cédric Carrard

             reply	other threads:[~2022-05-06 13:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-06 13:55 Cédric Carrard [this message]
2022-05-07 17:27 ` Rails 7 - Unicorn 6.1.0 -- reaped with preload_app Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/unicorn/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAOYoJW_=iOgik_wgKJNkvzkKJeu1uxOEW96iHXbr+VR99Rf0wg@mail.gmail.com' \
    --to=cedriccarrard@gmail.com \
    --cc=cedric.carrard@gmail.com \
    --cc=unicorn-public@yhbt.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/unicorn.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).