On Thu, Dec 2, 2010 at 9:38 AM, Grzegorz Nosek <r...@localdomain.pl> wrote:
> W dniu 02.12.2010 18:28, Roger Hoover pisze:
>>
>> Thank you, Grzegorz.  I looked over the patch and I don't see why the
>> outer reference counter is required.  It deletes the managed socket
>> from the SocketManager.sockets dictionary but why does that need to
>> happen?  Would there be a problem if that reference stayed in place?
>
> What I intended was to close the socket as soon as possible, but indeed, the
> internal reference counter (inside ManagedSocket) should take care of it.
> OTOH, wouldn't leaving the references there cause a memory "leak" (not
> really but you get the point) if we simply stopped using a socket (removed a
> fcgi-program completely and called supervisorctl update)? I expect this
> would cause SocketManager.sockets to grow over time.
>
> Weak references are the perfect match for this but IIRC supervisord aims for
> Python 2.3 compatibility so we cannot rely on weak references to objects
> containing sockets[1]. If I'm mistaken, using weakrefs would be the way to
> go IMHO.
>

What if the existing reference counter both closes the socket and
removes the reference?  I think that would make the code much simpler.

> Best regards,
>  Grzegorz Nosek
>
> 1. http://docs.python.org/library/weakref.html:
> Changed in version 2.4: Added support for files, sockets, arrays, and
> patterns.
>
_______________________________________________
Supervisor-users mailing list
Supervisor-users@lists.supervisord.org
http://lists.supervisord.org/mailman/listinfo/supervisor-users

Reply via email to