Hi, I'm experimenting with a Rack application and Unicorn and I have a
random error occurring when upgrading my app. When upgrading (sending
a USR2 + QUIT signals), 10% of the times unicorn master process and
its 2 worker processes start and after serving the first request they
crash.
This the stderror.log:
> 91.126.37.106 - - [13/Jul/2017:18:21:09 +0000] "GET /login HTTP/1.0" 200 1571
> 0.0473
> I, [2017-07-13T18:21:14.351677 #21426] INFO -- : executing
> ["/home/deployer/.rbenv/versions/2.4.1/bin/unicorn", "-c",
> "/home/deployer/apps/suppliers/current/config/unicorn.rb", "-E",
> "deployment", "-D", {12=>#<Kgio::UNIXServer:fd 12>}] (in
> /home/deployer/apps/suppliers/releases/20170713180855)
> I, [2017-07-13T18:21:14.351881 #21426] INFO -- : forked child re-executing...
> I, [2017-07-13T18:21:14.441075 #21426] INFO -- : inherited
> addr=/home/deployer/apps/suppliers/current/tmp/sockets/unicorn.socket fd=12
> I, [2017-07-13T18:21:14.441414 #21426] INFO -- : Refreshing Gem list
> I, [2017-07-13T18:21:14.576843 #21426] INFO -- : worker=0 spawning...
> I, [2017-07-13T18:21:14.577589 #21426] INFO -- : worker=1 spawning...
> I, [2017-07-13T18:21:14.578117 #21426] INFO -- : master process ready
> I, [2017-07-13T18:21:14.578866 #21430] INFO -- : worker=0 spawned pid=21430
> I, [2017-07-13T18:21:14.579053 #21430] INFO -- : worker=0 ready
> I, [2017-07-13T18:21:14.579649 #21432] INFO -- : worker=1 spawned pid=21432
> I, [2017-07-13T18:21:14.579790 #21432] INFO -- : worker=1 ready
> I, [2017-07-13T18:21:16.449066 #21369] INFO -- : reaped #<Process::Status:
> pid 21373 exit 0> worker=0
> I, [2017-07-13T18:21:16.449174 #21369] INFO -- : reaped #<Process::Status:
> pid 21375 exit 0> worker=1
> I, [2017-07-13T18:21:16.449207 #21369] INFO -- : master complete
> /home/deployer/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/unicorn-5.3.0/lib/unicorn/http_request.rb:80:in
> `parse': method `hash' called on unexpected T_NODE object (0x0055b15b973508
> flags=0xaa31b) (NotImplementedError)
> from
> /home/deployer/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/unicorn-5.3.0/lib/unicorn/http_request.rb:80:in
> `read'
> from
> /home/deployer/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/unicorn-5.3.0/lib/unicorn/http_server.rb:606:in
> `process_client'
> from
> /home/deployer/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/unicorn-5.3.0/lib/unicorn/http_server.rb:702:in
> `worker_loop'
> from
> /home/deployer/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/unicorn-5.3.0/lib/unicorn/http_server.rb:549:in
> `spawn_missing_workers'
> from
> /home/deployer/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/unicorn-5.3.0/lib/unicorn/http_server.rb:142:in
> `start'
> from
> /home/deployer/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/unicorn-5.3.0/bin/unicorn:126:in
> `<top (required)>'
> from /home/deployer/.rbenv/versions/2.4.1/bin/unicorn:22:in `load'
> from /home/deployer/.rbenv/versions/2.4.1/bin/unicorn:22:in `<main>'
> /home/deployer/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/unicorn-5.3.0/lib/unicorn/http_request.rb:80:in
> `parse': method `hash' called on unexpected T_NODE object (0x0055b15b973508
> flags=0xaa31b) (NotImplementedError)
> from
> /home/deployer/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/unicorn-5.3.0/lib/unicorn/http_request.rb:80:in
> `read'
> from
> /home/deployer/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/unicorn-5.3.0/lib/unicorn/http_server.rb:606:in
> `process_client'
> from
> /home/deployer/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/unicorn-5.3.0/lib/unicorn/http_server.rb:702:in
> `worker_loop'
> from
> /home/deployer/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/unicorn-5.3.0/lib/unicorn/http_server.rb:549:in
> `spawn_missing_workers'
> from
> /home/deployer/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/unicorn-5.3.0/lib/unicorn/http_server.rb:142:in
> `start'
> from
> /home/deployer/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/unicorn-5.3.0/bin/unicorn:126:in
> `<top (required)>'
> from /home/deployer/.rbenv/versions/2.4.1/bin/unicorn:22:in `load'
> from /home/deployer/.rbenv/versions/2.4.1/bin/unicorn:22:in `<main>'
> E, [2017-07-13T18:21:29.147001 #21426] ERROR -- : reaped #<Process::Status:
> pid 21432 exit 1> worker=1
> I, [2017-07-13T18:21:29.147127 #21426] INFO -- : worker=1 spawning...
> I, [2017-07-13T18:21:29.150907 #21439] INFO -- : worker=1 spawned pid=21439
> I, [2017-07-13T18:21:29.151109 #21439] INFO -- : worker=1 ready
> E, [2017-07-13T18:21:29.153360 #21426] ERROR -- : reaped #<Process::Status:
> pid 21430 exit 1> worker=0
> I, [2017-07-13T18:21:29.153424 #21426] INFO -- : worker=0 spawning...
> I, [2017-07-13T18:21:29.154226 #21442] INFO -- : worker=0 spawned pid=21442
> I, [2017-07-13T18:21:29.154383 #21442] INFO -- : worker=0 ready
This is the configuration of unicorn:
> DEPLOY_TO = "/home/deployer/apps/suppliers" # The path in which capistrano
> caches deployed versions of the source
> CURRENT = "#{DEPLOY_TO}/current" # The current, deployed release
> UNICORN_PID = "#{CURRENT}/tmp/pids/unicorn.pid" # Unicorn server process id
> file
> UNICORN_STDOUT = "#{CURRENT}/log/unicorn.stdout.log" # Log file for messages
> on standard output
> UNICORN_STDERR = "#{CURRENT}/log/unicorn.stderr.log" # Log file for messages
> on standard error
> UNICORN_SOCKET = "#{CURRENT}/tmp/sockets/unicorn.socket" # Server socket
>
> # Set unicorn options
> working_directory CURRENT
> worker_processes 2
> preload_app true
> timeout 30
>
> # Set up socket location
> listen UNICORN_SOCKET, :backlog => 64
>
> # Logging
> stderr_path UNICORN_STDERR
> stdout_path UNICORN_STDOUT
>
> # Set master PID location
> pid UNICORN_PID
Any idea what is happening?
Thanks!