[SERVER-5358] After an upgrade, --shutdown fails to shutdown the old version of mongod Created: 22/Mar/12  Updated: 11/Jul/16  Resolved: 10/Apr/12

Status: Closed
Project: Core Server
Component/s: Shell, Usability
Affects Version/s: 2.0.3
Fix Version/s: 2.0.5, 2.1.1

Type: Bug Priority: Minor - P4
Reporter: Thomas Dziedzic Assignee: Mathias Stearn
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

64bit archlinux


Attachments: File 0001-Backport-for-mongodb-2.0.4-Ignore-fork-and-logpath-w.patch     File 0002-Backport-for-mongodb-2.0.4-Don-t-check-proc-pid-exe-.patch    
Backwards Compatibility: Fully Compatible
Operating System: Linux
Participants:

 Description   

1. have mongodb 2.0.3 installed.
2. run the daemon with sudo rc.d start mongodb
3. upgrade mongodb to 2.0.4
4. try to stop the daemon with sudo rc.d stop mongodb

It prints FAIL and in /var/log/mongodb/mongod.log I get:
"Process 3604 is running /usr/bin/mongod (deleted) not mongod"

The problem here is the line at:
https://github.com/mongodb/mongo/blob/master/src/mongo/db/db.cpp#L1043
"else if (!endsWith(buf, "mongod")){"
My buf ends with "mongod (deleted)"

Note, the daemon is using the mongod --shutdown flag to stop the daemon.



 Comments   
Comment by auto [ 19/Apr/12 ]

Author:

{u'login': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}

Message: Don't check /proc/pid/exe in --shutdown SERVER-5358

It didn't mix well with updates. When the mongod binary is updated the
exe link gets " (deleted)" added to the path.
Branch: v2.0
https://github.com/mongodb/mongo/commit/264b914c4b19e3e6e094d49761e85e9555b49957

Comment by Thomas Dziedzic [ 11/Apr/12 ]

@Mathias: Thanks for the the tip, I backported the fix to ensure proper handling of --logpath w/ shutdown and the fix for this bug report.

Cheers!

edit: forgot to mention I attached both the commits to this bug report for reference.

Comment by Mathias Stearn [ 10/Apr/12 ]

@Thomas: if you backport that for the archlinux packages, you should also grab https://github.com/mongodb/mongo/commit/fa2e2ef95c5c934eef63fff4b98d5eb060c56539 to ensure proper handling of --logpath with --shutdown

Comment by auto [ 10/Apr/12 ]

Author:

{u'login': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}

Message: Don't check /proc/pid/exe in --shutdown SERVER-5358

It didn't mix well with updates. When the mongod binary is updated the
exe link gets " (deleted)" added to the path.
Branch: master
https://github.com/mongodb/mongo/commit/c28d97d1a14a36ffc056bfd9ba7262b0a1509b5b

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