Remove temporal directories when exitmap exits
https://github.com/NullHypothesis/exitmap/issues/44:
Sometimes, exitmap won't delete all temporary pymp directories in /tmp/. This might only happen in case of a non-clean shutdown. Either way, it should be fixed.
comment 2:
Firstly, irrespective of whether I give exitmap a clean shut down or not, the pymp-* folders and the temporary Tor directory are never deleted when I run the various modules, which is weird.
I read about multiprocessing in Python and checked eventhandler.py
for
some clues. I've modified the select_exits
function in exitmap.py to
check for only 2 exit relay fingerprints for now for testing purposes,
and I hope that doesn't cause any issues.
Currently, I've understood that the module_closure function returns the actual function to be run as a new subprocess whenever a new circuit is created using the EventListener class. This process is simply started asynchronously as a daemon and then is terminated together in a batch using proc.terminate(). I suspect this could be leaving behind the directories as the exit doesn't look to be clean. Comments and suggestions here are appreciated as this is just a hunch.
I'll be trying to see if there is a cleaner and more elegant way for the modules processes calls to end from the multiprocessing module. I'll keep you posted.