I have a persistant handler for REST calls which does a particular functionality using multi-threading until a flag value calls the process to stop (return).
On ideal scenario, my process should exit with respective PID getting killed. However, the entry remains for a minute or two and during that time if the REST call to same handler is made, it runs with same PID which makes it complicated to know which is the actual process.
Things gets complicated when same handler is called by different users on same machine. The os.getpid() method of python returns the first entry of PID for handler eventhough there are separate entries present.