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
*NEW* Splunk Love Promo!
Snag a $25 Visa Gift Card for Giving Your Review!

It's another Splunk Love Special! For a limited time, you can review one of our select Splunk products through Gartner Peer Insights and receive a $25 Visa gift card!

Review:





Or Learn More in Our Blog >>