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
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Enhance Security Operations with Automated Threat Analysis in the Splunk EcosystemAre you leveraging ...

What Is Splunk? Here’s What You Can Do with Splunk

Hey Splunk Community, we know you know Splunk. You likely leverage its unparalleled ability to ingest, index, ...

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...