I can only speculate on this because I don't have an idea why the
process is still holding a reference to the port. Actually, I have an
idea - but I don't know if it's correct :) I guess the child-process has
some "link" to the old TG process, preventing that from being collected
from the OS - and for some reason the socket isn't properly freed.
However, you might consider using the daemonize recipe in aspn python
cookbook to fork off another process that then will detatch itself from
the TG-process before invoking subprocess.
By that, you might get rid of the problem.
Another aleternative might be to not use the stdout and stderr-stuff, or
pointing these to /dev/null or such. They might otherwise form that
aforementioned "link"
Diez