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
- related to
-
SERVER-15407 Set thread name on Mac OS X and Linux
- Closed