[SERVER-27281] pkill/pgrep cannot find mongod on Linux Created: 05/Dec/16  Updated: 07/Sep/17  Resolved: 06/Dec/16

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 3.4.5, 3.5.1

Type: Bug Priority: Major - P3
Reporter: Mark Benvenuto Assignee: Mark Benvenuto
Resolution: Done Votes: 0
Labels: bkp
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Related
related to SERVER-15407 Set thread name on Mac OS X and Linux Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v3.4
Sprint: Platforms 2017-01-23
Participants:
Linked BF Score: 0

 Description   

pkill/pgrep uses the "Name" field in /proc/*/status as the name of process. On Linux, this field is the process name by default. But this field is not the process name, it is the thread name of the main thread. Thread names in Linux simply default to the process name.

If a program calls pthread_setname_np, the name is updated to be the thread name. This breaks simple commands like "pkill mongod" as an example. The proper command to use instead is "pkill initAndListen" since that is the name of the main thread. This is undesired behavior. MongoDB needs to stop setting thread names on the main() thread as a result of this behavior.

Reported by david.hows



 Comments   
Comment by Githook User [ 28/Apr/17 ]

Author:

{u'username': u'markbenvenuto', u'name': u'Mark Benvenuto', u'email': u'mark.benvenuto@mongodb.com'}

Message: SERVER-27281 pkill/pgrep cannot find mongod on Linux

(cherry picked from commit 726cafd713c7333640f8458ec9808ed4f678e3a7)
Branch: v3.4
https://github.com/mongodb/mongo/commit/4213c76de48f4e5c08009f8f347f817a77593019

Comment by Githook User [ 06/Dec/16 ]

Author:

{u'username': u'markbenvenuto', u'name': u'Mark Benvenuto', u'email': u'mark.benvenuto@mongodb.com'}

Message: SERVER-27281 pkill/pgrep cannot find mongod on Linux
Branch: master
https://github.com/mongodb/mongo/commit/726cafd713c7333640f8458ec9808ed4f678e3a7

Generated at Thu Feb 08 04:14:43 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.