| 1 |
--- fcgi_base.py 2007-09-10 17:46:32.000000000 -0500 |
|---|
| 2 |
+++ fcgi_base_pm.py 2008-09-12 10:16:39.000000000 -0500 |
|---|
| 3 |
@@ -558,7 +558,14 @@ |
|---|
| 4 |
protocolStatus, appStatus = self.server.handler(self) |
|---|
| 5 |
except: |
|---|
| 6 |
traceback.print_exc(file=self.stderr) |
|---|
| 7 |
- self.stderr.flush() |
|---|
| 8 |
+ # PM - close connection on EPIPE |
|---|
| 9 |
+ try: |
|---|
| 10 |
+ self.stderr.flush() |
|---|
| 11 |
+ except socket.error, e: |
|---|
| 12 |
+ if e[0] == errno.EPIPE: |
|---|
| 13 |
+ self._conn._sock.close() |
|---|
| 14 |
+ return |
|---|
| 15 |
+ # PM - end |
|---|
| 16 |
if not self.stdout.dataWritten: |
|---|
| 17 |
self.server.error(self) |
|---|
| 18 |
|
|---|
| 19 |
@@ -573,6 +580,7 @@ |
|---|
| 20 |
except socket.error, e: |
|---|
| 21 |
if e[0] != errno.EPIPE: |
|---|
| 22 |
raise |
|---|
| 23 |
+ self._conn._sock.close() # PM - close socket! |
|---|
| 24 |
|
|---|
| 25 |
def _end(self, appStatus=0L, protocolStatus=FCGI_REQUEST_COMPLETE): |
|---|
| 26 |
self._conn.end_request(self, appStatus, protocolStatus) |
|---|
| 27 |
@@ -1126,6 +1134,7 @@ |
|---|
| 28 |
except socket.error, e: |
|---|
| 29 |
if e[0] != errno.EPIPE: |
|---|
| 30 |
raise # Don't let EPIPE propagate beyond server |
|---|
| 31 |
+ self._conn._sock.close() # PM - close socket! |
|---|
| 32 |
finally: |
|---|
| 33 |
if not self.multithreaded: |
|---|
| 34 |
self._appLock.release() |
|---|
| 35 |
|
|---|