Skip to content

Instantly share code, notes, and snippets.

@msp
Created May 19, 2011 11:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save msp/980551 to your computer and use it in GitHub Desktop.
Save msp/980551 to your computer and use it in GitHub Desktop.
Unicorn and logrotate
Unhandled listen loop exception #<IOError: closed stream>.
/var/www/drownedinsound/shared/bundle/ruby/1.8/gems/unicorn-3.3.1/lib/unicorn/http_server.rb:624:in `select'
/var/www/drownedinsound/shared/bundle/ruby/1.8/gems/unicorn-3.3.1/lib/unicorn/http_server.rb:624:in `worker_loop'
/var/www/drownedinsound/shared/bundle/ruby/1.8/gems/newrelic_rpm-2.13.4/lib/new_relic/agent/instrumentation/unicorn_instrumentation.rb:7:in `call'
/var/www/drownedinsound/shared/bundle/ruby/1.8/gems/newrelic_rpm-2.13.4/lib/new_relic/agent/instrumentation/unicorn_instrumentation.rb:7:in `worker_loop'
/var/www/drownedinsound/shared/bundle/ruby/1.8/gems/unicorn-3.3.1/lib/unicorn/http_server.rb:496:in `spawn_missing_workers'
/var/www/drownedinsound/shared/bundle/ruby/1.8/gems/unicorn-3.3.1/lib/unicorn/http_server.rb:493:in `fork'
/var/www/drownedinsound/shared/bundle/ruby/1.8/gems/unicorn-3.3.1/lib/unicorn/http_server.rb:493:in `spawn_missing_workers'
/var/www/drownedinsound/shared/bundle/ruby/1.8/gems/unicorn-3.3.1/lib/unicorn/http_server.rb:489:in `each'
/var/www/drownedinsound/shared/bundle/ruby/1.8/gems/unicorn-3.3.1/lib/unicorn/http_server.rb:489:in `spawn_missing_workers'
/var/www/drownedinsound/shared/bundle/ruby/1.8/gems/unicorn-3.3.1/lib/unicorn/http_server.rb:503:in `maintain_worker_count'
/var/www/drownedinsound/shared/bundle/ruby/1.8/gems/unicorn-3.3.1/lib/unicorn/http_server.rb:297:in `join'
/var/www/drownedinsound/shared/bundle/ruby/1.8/gems/unicorn-3.3.1/lib/unicorn.rb:13:in `run'
/var/www/drownedinsound/shared/bundle/ruby/1.8/gems/unicorn-3.3.1/bin/unicorn_rails:208
/var/www/drownedinsound/shared/bundle/ruby/1.8/bin/unicorn_rails:19:in `load'
/var/www/drownedinsound/shared/bundle/ruby/1.8/bin/unicorn_rails:19
master reopening logs...
master done reopening logs
worker=6 reopening logs...
worker=15 reopening logs...
worker=0 reopening logs...
worker=13 reopening logs...
worker=5 reopening logs...
worker=7 reopening logs...
worker=9 reopening logs...
worker=8 reopening logs...
worker=12 reopening logs...
worker=3 reopening logs...
worker=11 reopening logs...
worker=10 reopening logs...
worker=2 reopening logs...
master reopening logs...
worker=14 reopening logs...
worker=1 reopening logs...
worker=4 reopening logs...
@humbroll
Copy link

I have a same problem exactly.
I found that is known issue on unicorn 1.1.x(http://rubyforge.org/pipermail/mongrel-unicorn/2011-March/000893.html)
Any solution?

@msp
Copy link
Author

msp commented Nov 27, 2011

@humbroll
Copy link

I use the "lastaction" option already. my configuration is like below..

/...../me2day/shared/log/unicorn.*.log {
        daily
        missingok
        notifempty
        sharedscripts
        postrotate
        endscript
        rotate 90
        create 0666 irteam irteam
        dateext
        delaycompress
        lastaction
                pid=/home1/irteam/me2day/current/tmp/pids/unicorn.pid
                test -s $pid && kill -USR1 "$(cat $pid)"
        endscript
}

but the IOError: closed stream occured every logrotate command excuting time.
error log like this,

app error: closed stream (IOError)
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/unicorn-4.1.1/lib/unicorn/http_response.rb:38:in `write'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/unicorn-4.1.1/lib/unicorn/http_response.rb:38:in `http_response_write'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/unicorn-4.1.1/lib/unicorn/http_server.rb:536:in `process_client'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/unicorn-4.1.1/lib/unicorn/oob_gc.rb:60:in `process_client'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/unicorn-4.1.1/lib/unicorn/http_server.rb:600:in `worker_loop'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/unicorn-4.1.1/lib/unicorn/http_server.rb:485:in `spawn_missing_workers'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/unicorn-4.1.1/lib/unicorn/http_server.rb:496:in `maintain_worker_count'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/unicorn-4.1.1/lib/unicorn/http_server.rb:270:in `join'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/unicorn-4.1.1/bin/unicorn_rails:209
/opt/ruby-enterprise-1.8.7-2010.02/bin/unicorn_rails:19:in `load'
/opt/ruby-enterprise-1.8.7-2010.02/bin/unicorn_rails:19

Could u tell me Any solution?;;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment