[SERVER-21209] PIDFILEPATH computation in init scripts fails to handle comments after values Created: 29/Oct/15  Updated: 25/Nov/15  Resolved: 04/Nov/15

Status: Closed
Project: Core Server
Component/s: Packaging
Affects Version/s: None
Fix Version/s: 3.0.8, 3.2.0-rc3

Type: Bug Priority: Major - P3
Reporter: Ramon Fernandez Marina Assignee: Ernie Hershey
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-20947 'service mongod stop' does not stop m... Closed
is duplicated by SERVER-21321 daemon script pid parse issue Closed
is duplicated by SERVER-21668 Mongo not stopping on 3.0.7 Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Completed:
Sprint: Build C (11/20/15)
Participants:

 Description   

Found by Paschalis Korosoglou and reported via githib:

I noticed (CentOS 6) that the init script fails to parse the contents of the configuration file as expected resulting in failure to stop the service when asked.

The error steps in from this line in the init script:

PIDFILEPATH=`awk -F'[:=]' -v IGNORECASE=1 '/^[[:blank:]]*(processManagement\.)?pidfilepath[[:blank:]]*[:=][[:blank:]]*/{print $2}' "$CONFIGFILE" | tr -d "[:blank:]\"'"`

What happens is that the PIDFILEPATH variable gets populated with all contents following the variable pidFilePath in the configuration file with spaces omitted. Hence using the default configuration file the bash variable gets the value:

# echo $PIDFILEPATH
/var/run/mongodb/mongod.pid#locationofpidfile



 Comments   
Comment by Ramon Fernandez Marina [ 25/Nov/15 ]

There's a simple workaround for users affected by this issue in SERVER-20947.

Comment by Githook User [ 04/Nov/15 ]

Author:

{u'username': u'pkoro', u'name': u'Paschalis Korosoglou', u'email': u'pkoro@grid.auth.gr'}

Message: SERVER-21209 allow comments in the same line as pidfilepath

Signed-off-by: Ramon Fernandez <ramon@mongodb.com>

Closes #1041

(cherry picked from commit 9fe07e29d8bdfb74962fac210214b1723c8dc6fc)
Branch: v3.0
https://github.com/mongodb/mongo/commit/21cf82b2fe379d6ba0bd4aabd5076370a3a04c49

Comment by Githook User [ 04/Nov/15 ]

Author:

{u'username': u'pkoro', u'name': u'Paschalis Korosoglou', u'email': u'pkoro@grid.auth.gr'}

Message: SERVER-21209 allow comments in the same line as pidfilepath

Signed-off-by: Ramon Fernandez <ramon@mongodb.com>

Closes #1041
Branch: master
https://github.com/mongodb/mongo/commit/9fe07e29d8bdfb74962fac210214b1723c8dc6fc

Generated at Thu Feb 08 03:56:39 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.