Supervisor/supervisor — Issue #89: supervisord leaks memory on reloads with globs
Author: philz
Created: 2012-02-21 23:55:06+00:00
State: open

I'm using 'supervisor_ctl.onecmd("update")' to update a running supervisord process. After running for a while, I found that supervisord was using more and more memory. I used Heapy (see http://www.smira.ru/wp-content/uploads/2011/08/heapy.html) and a temporary backdoor in the web interface to figure out that supervisord was managing an array which kept growing, which had the following string in it:

'Included extra file "..." during parsing'

I'm using a glob in the configuration, and it turns out that options.py writes the following:

self.parse_warnings.append(
'Included extra file "%s" during parsing' % filename)

Since self.parse_warnings is not cleared between runs of the options parser, the array grows without bounds.

The simple fix is to clear self.parse_warnings at every parse_config() call. Other alternatives, like dropping the warnings entirely, or having reload initialize a new object, seem more invasive.