[SERVER-13607] mongod 2.4.10 does not delete PID file on exit Created: 16/Apr/14  Updated: 19/Nov/16  Resolved: 14/Nov/16

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: 2.4.10, 2.6.3, 2.7.3
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Stefan Seide Assignee: Kelsey Schubert
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

x86_64


Issue Links:
Related
is related to SERVER-27016 mongod.pid is not removed when callin... Closed
Operating System: Linux
Steps To Reproduce:

add pidfilepath=/data/db/mongod.pid to config file
start mongod
stop mongod - the old pidfile is not deleted

Participants:

 Description   

my /etc/mongod.conf defines an pidfile. On server startup the pid file gets created with the correct process id in it.
Terminating mongod with the provided init-script (upstart) does not delete the pid file and the file contains the old process id (it does not get cleared out as the lock file)

System ubuntu 12.04 / 64bit
MongoDB 2.4.10
deb archve from http://downloads-distro.mongodb.org/repo/ubuntu-upstart

Best regards



 Comments   
Comment by Kelsey Schubert [ 14/Nov/16 ]

Hi stefan@seide.st,

This is the intended behavior. If the lock file is present, then the PID file is valid. If the lock file is not present, then the PID file is either stale (and can be overwritten) or can be used to check for error conditions (the lock file was removed but the process is still running).

Kind regards,
Thomas

Comment by Stefan Seide [ 04/Jul/14 ]

Hi Thomas,

sorry for being late. I modified the upstart script to start mongodb with "mongodb -vv --config /etc/mongodb.conf", using the same config file es before and executed the "service mongodb start" and "service mongodb stop" commands.

The last lines of the logfile /var/log/mongodb/mongodb.log are:

Fri Jul 4 14:44:45.183 [journal] journal REMAPPRIVATEVIEW done startedAt: 2 n:2 0ms
Fri Jul 4 14:44:45.487 [conn5] runQuery called admin.$cmd

{ replSetHeartbeat: "rs0", v: 32013, pv: 1, checkEmpty: false, from: "db02:27017" }

Fri Jul 4 14:44:45.487 [conn5] run command admin.$cmd

{ replSetHeartbeat: "rs0", v: 32013, pv: 1, checkEmpty: false, from: "db02:27017" }

Fri Jul 4 14:44:45.487 [conn5] command:

{ replSetHeartbeat: "rs0", v: 32013, pv: 1, checkEmpty: false, from: "db02:27017" }

Fri Jul 4 14:44:45.487 [conn5] command admin.$cmd command:

{ replSetHeartbeat: "rs0", v: 32013, pv: 1, checkEmpty: false, from: "db02:27017 " }

ntoreturn:1 keyUpdates:0 reslen:209 0ms
Fri Jul 4 14:44:45.503 [signalProcessingThread] got signal 15 (Terminated), will terminate after current cmd ends
Fri Jul 4 14:44:45.503 [signalProcessingThread] now exiting
Fri Jul 4 14:44:45.503 dbexit:
Fri Jul 4 14:44:45.503 [signalProcessingThread] shutdown: going to close listening sockets...
Fri Jul 4 14:44:45.503 [signalProcessingThread] closing listening socket: 11
Fri Jul 4 14:44:45.503 [signalProcessingThread] closing listening socket: 12
Fri Jul 4 14:44:45.503 [signalProcessingThread] closing listening socket: 13
Fri Jul 4 14:44:45.503 [signalProcessingThread] removing socket file: /tmp/mongodb-27017.sock
Fri Jul 4 14:44:45.503 [signalProcessingThread] shutdown: going to flush diaglog...
Fri Jul 4 14:44:45.503 [signalProcessingThread] shutdown: going to close sockets...
Fri Jul 4 14:44:45.503 [signalProcessingThread] shutdown: waiting for fs preallocator...
Fri Jul 4 14:44:45.503 [signalProcessingThread] shutdown: lock for final commit...
Fri Jul 4 14:44:45.503 [signalProcessingThread] shutdown: final commit...
Fri Jul 4 14:44:45.503 [signalProcessingThread] journal REMAPPRIVATEVIEW done startedAt: 0 n:1 0ms
Fri Jul 4 14:44:45.503 [rsBackgroundSync] SocketException: remote: 10.1.2.3:27017 error: 9001 socket exception [CLOSED] server [10.1.2.3:27017]
Fri Jul 4 14:44:45.503 [rsBackgroundSync] User Assertion: 10278:dbclient error communicating with server: db01:27017
Fri Jul 4 14:44:45.504 [conn9] SocketException: remote: 10.1.2.4:45153 error: 9001 socket exception [CLOSED] server [10.1.2.4:45153]
Fri Jul 4 14:44:45.504 [conn9] end connection 10.1.2.4:45153 (5 connections now open)
Fri Jul 4 14:44:45.504 [conn8] SocketException: remote: 10.1.2.5:33403 error: 9001 socket exception [CLOSED] server [10.1.2.5:33403]
Fri Jul 4 14:44:45.518 [conn8] end connection 10.1.2.5:33403 (4 connections now open)
Fri Jul 4 14:44:45.504 [conn2] SocketException: remote: 10.1.2.3:48459 error: 9001 socket exception [CLOSED] server [10.1.2.3:48459]
Fri Jul 4 14:44:45.518 [conn2] end connection 10.1.2.3:48459 (3 connections now open)
Fri Jul 4 14:44:45.504 [conn7] SocketException: remote: 10.1.2.6:46948 error: 9001 socket exception [CLOSED] server [10.1.2.6:46948]
Fri Jul 4 14:44:45.518 [conn7] end connection 10.1.2.6:46948 (2 connections now open)
Fri Jul 4 14:44:45.504 [conn3] SocketException: remote: 10.1.2.3:48460 error: 9001 socket exception [CLOSED] server [10.1.2.3:48460]
Fri Jul 4 14:44:45.518 [conn3] end connection 10.1.2.3:48460 (1 connection now open)
Fri Jul 4 14:44:45.504 [conn5] SocketException: remote: 10.1.2.7:34359 error: 9001 socket exception [CLOSED] server [10.1.2.7:34359]
Fri Jul 4 14:44:45.518 [conn5] end connection 10.1.2.7:34359 (0 connections now open)
Fri Jul 4 14:44:45.506 [signalProcessingThread] shutdown: closing all files...
Fri Jul 4 14:44:45.518 [signalProcessingThread] journal REMAPPRIVATEVIEW done startedAt: 1 n:1 0ms
Fri Jul 4 14:44:45.519 [signalProcessingThread] journal REMAPPRIVATEVIEW done startedAt: 2 n:1 0ms
Fri Jul 4 14:44:45.519 [signalProcessingThread] journal REMAPPRIVATEVIEW done startedAt: 0 n:1 0ms
Fri Jul 4 14:44:45.519 [signalProcessingThread] journal REMAPPRIVATEVIEW done startedAt: 1 n:1 0ms
Fri Jul 4 14:44:45.519 [signalProcessingThread] closeAllFiles() finished
Fri Jul 4 14:44:45.519 [signalProcessingThread] journalCleanup...
Fri Jul 4 14:44:45.519 [signalProcessingThread] removeJournalFiles
Fri Jul 4 14:44:45.518 [rsBackgroundSync] replSet sync source problem: 10278 dbclient error communicating with server: db01:27017
Fri Jul 4 14:44:45.533 [signalProcessingThread] flushing directory /data/db/journal
Fri Jul 4 14:44:45.548 [signalProcessingThread] removeJournalFiles end
Fri Jul 4 14:44:45.548 [signalProcessingThread] shutdown: removing fs lock...
Fri Jul 4 14:44:45.549 [signalProcessingThread] shutdown: groupCommitMutex
Fri Jul 4 14:44:45.549 dbexit: really exiting now

Comment by Thomas Rueckstiess [ 03/Jul/14 ]

Hi Stefan,

We still need the log file that covers the shutdown to continue on this issue. Can you attach it please?

Thanks,
Thomas

Comment by Thomas Rueckstiess [ 01/May/14 ]

Hi Stefan,

I meant just the part where it shows the shutdown of mongod. If you can repeat the process with a higher verbosity level (for example by adding -vv to the command line when starting mongod) and providing the higher verbosity log file, that would be even better.

Thanks,
Thomas

Comment by Stefan Seide [ 22/Apr/14 ]

my current configuration "/etc/mongodb.conf" is quit short, it just contains the following 5 parameter:

==
dbpath=/data/db
logpath=/var/log/mongodb/mongodb.log
fork = false
pidfilepath=/data/db/mongod.pid
replSet = rs0
==

the effective commandline ( taken from 'ps ax') is
"/usr/bin/mongod --config /etc/mongodb.conf"

What kind of log snippet do you mean? started with some special debug/logging flags?

Comment by Thomas Rueckstiess [ 17/Apr/14 ]

Hi Stefan,

Can you provide a log snippet that contains the shutdown messages? Can you also provide your mongod.conf?

Thanks,
Thomas

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