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!

Introduction to Splunk Observability Cloud - Building a Resilient Hybrid Cloud

Introduction to Splunk Observability Cloud - Building a Resilient Hybrid Cloud  In today’s fast-paced digital ...

Observability protocols to know about

Observability protocols define the specifications or formats for collecting, encoding, transporting, and ...

Take Your Breath Away with Splunk Risk-Based Alerting (RBA)

WATCH NOW!The Splunk Guide to Risk-Based Alerting is here to empower your SOC like never before. Join Haylee ...