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!

Splunk Mobile: Your Brand-New Home Screen

Meet Your New Mobile Hub  Hello Splunk Community!  Staying connected to your data—no matter where you are—is ...

Introducing Value Insights (Beta): Understand the Business Impact your organization ...

Real progress on your strategic priorities starts with knowing the business outcomes your teams are delivering ...

Enterprise Security (ES) Essentials 8.3 is Now GA — Smarter Detections, Faster ...

As of today, Enterprise Security (ES) Essentials 8.3 is now generally available, helping SOC teams simplify ...