Non-terminating php-fcgi causing lack of memory

I am running a quite large WordPress multisite installation with apache2 and php-fcgi. We are executing php-fcgi via a wrapper script because some time ago, we needed to support different versions.

I’ve got a problem that I do not know how to debug anymore: Over time, lots of php-fcgi instances spawn that never get killed. All multisites use more or less the same setup, but unfortunately they all run under the same user (not a good idea I know), so I cannot even track down if it’s one multisite or multiple causing the issue. This leads to extreme high memory usage until after some days, apache crashes.

This is the relevant part of the vhost setup:

Options All ExecCGI AddHandler fcgid-script .php  <Directory /..> Options -Indexes +FollowSymLinks +Includes +ExecCGI FCGIWrapper /*/php-fcgi/php-fcgi-starter .php </Directory> 

And this is the php-fcgi-starter:

#!/bin/sh PHPRC="**/conf/" export PHPRC export TMPDIR=**tmp exec /usr/bin/php-cgi 

Does anybody have an idea what the issue might be or how to debug this (e.g. pin it down to a specific script)? The logs are not helping.

Thank you so much.