LSWS 4.0.x and AJP app

I'm running into some nasty connection errors (which lead to 503 occuring frequently on my site) with an Django app running trough flup's AJP protocol and a LSWS connector.

Log from flup-ajp django daemon:
2009-08-26 10:40:38 : Exception caught in Connection
Traceback (most recent call last):
  File "/var/lib/python-support/python2.4/flup/server/", line 618, in run
  File "/var/lib/python-support/python2.4/flup/server/", line 649, in processInput
  File "/var/lib/python-support/python2.4/flup/server/", line 707, in _forwardRequest
  File "/var/lib/python-support/python2.4/flup/server/", line 498, in run
  File "/var/lib/python-support/python2.4/flup/server/", line 740, in writePacket
  File "/var/lib/python-support/python2.4/flup/server/", line 312, in write
    self._sendall(sock, CONTAINER_PREFIX + struct.pack('>H', self.length))
  File "/var/lib/python-support/python2.4/flup/server/", line 298, in _sendall
    sent = sock.send(data)
error: (32, 'Broken pipe')
Vhost's external app config:
Type: Servlet engine
Max Connections: 100
Connection Keepalive Timeout: -1
Initial Request Timeout: 60
Retry Timeout: 3
The flup-ajp django process is run by this command:
/usr/bin/python $DIR/ runfcgi method=threaded daemonize=false \
        maxrequests=0 \
        maxchildren=300 \
        minspare=30 \
        maxspare=60 \
        protocol=ajp \
        host= port=3033
I'm suspecting, that LSWS is the cause here, as using apache with mod-jk on the same flup-ajp django instance (yes! it's lightning fast) yelds no errors at all.

The connection count from LSWS to the app floats between the max allowed connection limit in LSWS while operating normally (no 503 errors), and drops to:
 ~$ netstat -a -n | grep 3033 | grep ESTABLISHED  | wc -l
while the 503 errors occurs.

The bug has been observed on every 4.0.x version. Currently testing with 3.x

Help, please? :)
Last edited:


LiteSpeed Staff
I think there is somehting that LSWS does not like in the AJP packet sent by flup-ajp, so web server side closed the connection.
If it can be reproduced with certain URL, you can grep 503 error in access log see if it only happen to certain URL.
You can use tcpdump to capture the data exchanged between LSWS and flup-ajp.