The truth is rarely pure and never simple

Phusion Passenger and Django Deadlock

If you have the following symptom: You use Django and Phusion Passenger in at least version 4. A specific request is waiting forever. Restarting apache has no effect.

Then you can check for the states of the current requests by using passenger-status –show requests. The output looks like this:

Version : 4.0.37
Date    : 2015-10-23 15:52:11 +0200
Instance: 18806
2 clients:
  Client 19:
    host                        = status.vonrudorff.de
    uri                         = /dash/
    connected at                = 2015-10-23 15:52:02 (9 sec ago)
    state                       = FORWARDING_BODY_TO_APP
    session pid                 = 18883 (/var/www/vhosts/vonrudorff.de/status.vonrudorff.de#default)
    session gupid               = 16fa320-twCtvOIdbmE
    session initiated           = true
    requestBodyIsBuffered       = false
    contentLength               = -1
    clientBodyAlreadyRead       = 0
    clientInput                 = 0x7f87c4001490 fd=19, state=END_OF_STREAM, buffer(0)="", paused=1, socketPaused=1, nextTickInstalled=0, generation=2, error=0
    clientInput started         = false
    clientBodyBuffer started    = false
    clientBodyBuffer reachedEnd = false
    clientOutputPipe started    = true
    clientOutputPipe reachedEnd = false
    clientOutputWatcher active  = false
    appInput                    = 0x7f87c40037a0 fd=21, state=LIVE, buffer(0)="", paused=0, socketPaused=0, nextTickInstalled=0, generation=2, error=0
    appInput started            = true
    appInput reachedEnd         = false
    responseHeaderSeen          = false
    useUnionStation             = false

If state is FORWARDING_BODY_TO_APP and connected at is suitably long ago, then this may be due to the source code of your Django app requesting a module that is not installed yet. In this case, the import error is thrown but no standard output is sent back to Phusion Passenger. Therefore, the request hangs. You can see this by looking into the log of your Django app.

Leave a comment

Your email address will not be published.