Splunk Enterprise Security

Process created on persistant handler does not exit even after returning

rshah_splunk
Splunk Employee
Splunk Employee

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.

root 15144 28.7 7.4 515644 287464 ? Sl 14:33 2:38 /opt/splunk/bin/python /opt/splunk/lib/python2.7/site-packages/splunk/persistconn/appserver.py

root 16272 8.3 0.6 147404 23820 ? S 14:42 0:00 /opt/splunk/bin/python /opt/splunk/lib/python2.7/site-packages/splunk/persistconn/appserver.py

os.getpid() always returns me 15144 and never 16272.
Even after returning from REST call, the given entry for PID exists for some time.

Is there an alternate way to gracefully handle this and exiting the process?

0 Karma
Get Updates on the Splunk Community!

Index This | When is October more than just the tenth month?

October 2025 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What’s New & Next in Splunk SOAR

 Security teams today are dealing with more alerts, more tools, and more pressure than ever.  Join us for an ...