Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Puma crashes with no output when stdout_redirect is set #359

Closed
natew opened this issue Aug 27, 2013 · 5 comments
Closed

Puma crashes with no output when stdout_redirect is set #359

natew opened this issue Aug 27, 2013 · 5 comments

Comments

@natew
Copy link

natew commented Aug 27, 2013

Using rails 4, rubinius at master (372b2d2) and puma 2.5.0.

Current config:

#!/usr/bin/env puma

basedir = '/var/www/2u/web/current'

directory "#{basedir}"
environment 'production'
daemonize true

bind "unix://#{basedir}/tmp/puma/puma.sock"
pidfile "#{basedir}/tmp/puma/pid"
state_path "#{basedir}/tmp/puma/state"

# stdout_redirect "#{basedir}/tmp/log/out.puma.log", "#{basedir}/tmp/log/err.puma.log", true

threads 4, 24
#workers 1
preload_app!

When i uncomment the stdout_redirect it will write to out.puma.log:

=== puma startup: 2013-08-27 16:09:15 +0000 ===

But it crashes after what seems like the full bootup, with nothing going into err.puma.log.

Edit: looks like working now.

@natew natew closed this as completed Aug 27, 2013
@knopkodav
Copy link

The same problem again.

$ ruby -v
ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-linux]
$ bundle exec puma -C ./config/puma.rb
[32374] Puma starting in cluster mode...
[32374] * Version 2.7.0, codename: Earl of Sandwich Partition
[32374] * Min threads: 4, max threads: 16
[32374] * Environment: production
[32374] * Process workers: 2
[32374] * Preloading application
[32374] * Listening on unix:///srv/prj/shared/sockets/puma.sock
[32374] * Daemonizing...

No process, no answer, and no log files appears.

UPD: our config:

      daemonize
      environment           'production'
      directory             '/srv/prj/releases/20131205131955'
      state_path            '/srv/prj/shared/sockets/puma.state'
      bind                  'unix:///srv/prj/shared/sockets/puma.sock'
      activate_control_app  'unix:///srv/prj/shared/sockets/pumactl.sock'
      stdout_redirect       '/srv/prj/shared/log/puma.stdout', '/srv/prj/shared/log/puma.stderr', true

      threads 4, 16
      workers 2
      preload_app!
      on_worker_boot do
        ActiveSupport.on_load(:active_record) do
          ActiveRecord::Base.establish_connection
        end
      end

@zekus
Copy link

zekus commented Dec 9, 2014

I have something similar too
it crashes and nothing gets written in the logs. I can see the error only if I do not demonize it

@evanphx
Copy link
Member

evanphx commented Dec 10, 2014

@zekus what error do you see when not demonized?

@zekus
Copy link

zekus commented Dec 10, 2014

@evanphx it was a syntax error in the application code but the point is: shouldn't puma fail to start but write the reason in the log?

@evanphx
Copy link
Member

evanphx commented Dec 13, 2014

Ok, here is the issue:

Some people want puma to load the code BEFORE daemonizing, so that the user can see if there is an error. Other people need it to load AFTER demonizing because they start threads in their initializers and thus need them to survive.

So there is this tension between these 2 needs. I'll see about at least making it so that if there is an error like this, it shows up in the stderr output.

@evanphx evanphx reopened this Dec 13, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants