Hi tech,

The attached patch fixes a problem I’ve been having with httpd +
php_fpm + owncloud on 5.7. The patch is against 5.7-release.

After several days running owncloud with httpd, php_fpm started
complaining about hitting pm.max_children, and top would show a
bunch of idle php_fpm processes waiting on netio. Eventually httpd
would start returning error 500 and owncloud would stop working.
Restarting php_fpm or httpd would temporarily fix the issue. The
same server with nginx did not have the same problem.

I’ve had this patch running for 5 days now, and php_fpm isnt leaving
idle processes lying around anymore. I did run with some debugging
output to verify that clt->clt_fd is sometimes not -1 when it is
overwritten with the new socket fd.

I’m happy to test or revise if needed. 

Thank you!
Todd


Index: server_fcgi.c
===================================================================
RCS file: /cvs/src/usr.sbin/httpd/server_fcgi.c,v
retrieving revision 1.52
diff -u -p -u -p -r1.52 server_fcgi.c
--- server_fcgi.c       23 Feb 2015 19:22:43 -0000      1.52
+++ server_fcgi.c       15 May 2015 22:12:30 -0000
@@ -31,6 +31,7 @@
#include <stdio.h>
#include <time.h>
#include <ctype.h>
+#include <unistd.h>
#include <event.h>

#include "httpd.h"
@@ -152,6 +153,9 @@ server_fcgi(struct httpd *env, struct cl
               errstr = "failed to allocate evbuffer";
               goto fail;
       }
+
+       if (clt->clt_fd != -1)
+               close(clt->clt_fd);

       clt->clt_fd = fd;
       if (clt->clt_srvbev != NULL)

Reply via email to