[SERVER-76179] "/var/run/mongodb/"mongod.pid" deleted on each Mongod shutdown Created: 17/Apr/23  Updated: 29/Oct/23  Resolved: 04/May/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 5.0.16
Fix Version/s: 7.1.0-rc0, 5.0.18, 7.0.0-rc1, 6.0.7, 4.4.23

Type: Bug Priority: Major - P3
Reporter: Tedi Roca Assignee: Alex Neben
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
is related to SERVER-74345 mongodb-org-server 4.4.19, 5.0.15, 6.... Closed
is related to SERVER-74845 Create mechanism to ignore ignore for... Closed
Assigned Teams:
Server Development Platform
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v7.0, v6.3, v6.0, v5.0, v4.4
Steps To Reproduce:
  1. Upgrade from Mongo 5.0.14 to 5.0.16
  2. Start mongod with fork = true

 

Now create the directroy manually an set the permissions for mongod to own it, and start mongod with fork = true - works fine:

 

Participants:
Case:

 Description   

```

{"t":\{"$date":"2023-04-17T13:50:46.795+02:00"}

,"s":"I",  "c":"CONTROL",  "id":23330,   "ctx":"main","msg":"ERROR: Cannot write pid file to {path_string}: {errAndStr_second}","attr":{"path_string":"/var/run/mongodb/mongod.pid","errAndStr_second":"No such file or directory"}}

```

mongod.conf

```

  1. mongod.conf
  1. for documentation of all options, see:
  2.   http://docs.mongodb.org/manual/reference/configuration-options/
  1. where to write logging data.
    systemLog:
      destination: file
      logAppend: true
      path: /var/log/mongodb/mongod.log
  1. Where and how to store data.
    storage:
      dbPath: /var/lib/mongo
      journal:
        enabled: true
  2.  engine:
  3.  wiredTiger:
  1. how the process runs
    processManagement:
      fork: true  # fork and run in background
      pidFilePath: /var/run/mongodb/mongod.pid  # location of pidfile
      timeZoneInfo: /usr/share/zoneinfo
  1. network interfaces
    net:
      port: 27017
      bindIpAll: true

security:
  authorization:
    enabled
  keyFile: /etc/ssl/mongo_replica.key
#operationProfiling:

replication:
  replSetName: xxxx

#sharding:

    1. Enterprise-Only Options

#auditLog:

#snmp:

```

OS: CentOS 7

 



 Comments   
Comment by Githook User [ 17/May/23 ]

Author:

{'name': 'Alexander Neben', 'email': 'alexander.neben@mongodb.com', 'username': 'IamXander'}

Message: SERVER-76179 Add RuntimeDirectory to mongod.service for RPM

(cherry picked from commit e968d9507a2d038004de32250ea62edaa627d39e)
Branch: v4.4
https://github.com/mongodb/mongo/commit/74e04c5444bdcea243c1328ce0ae5cb969bf7003

Comment by Githook User [ 04/May/23 ]

Author:

{'name': 'Alexander Neben', 'email': 'alexander.neben@mongodb.com', 'username': 'IamXander'}

Message: SERVER-76179 Add RuntimeDirectory to mongod.service for RPM

(cherry picked from commit e968d9507a2d038004de32250ea62edaa627d39e)
Branch: v7.0
https://github.com/mongodb/mongo/commit/ecc52df49ddbf748395f72484989424a366d465c

Comment by Githook User [ 04/May/23 ]

Author:

{'name': 'Alexander Neben', 'email': 'alexander.neben@mongodb.com', 'username': 'IamXander'}

Message: SERVER-76179 Add RuntimeDirectory to mongod.service for RPM

(cherry picked from commit e968d9507a2d038004de32250ea62edaa627d39e)
Branch: v6.0
https://github.com/mongodb/mongo/commit/be7667ad1a93b9e87fc19ccdb43a5a9a3cddd948

Comment by Githook User [ 04/May/23 ]

Author:

{'name': 'Alexander Neben', 'email': 'alexander.neben@mongodb.com', 'username': 'IamXander'}

Message: SERVER-76179 Add RuntimeDirectory to mongod.service for RPM

(cherry picked from commit e968d9507a2d038004de32250ea62edaa627d39e)
Branch: v5.0
https://github.com/mongodb/mongo/commit/58e64eeac698a4cbc5e7210ffa7aacd2e9a2b931

Comment by Githook User [ 04/May/23 ]

Author:

{'name': 'Alexander Neben', 'email': 'alexander.neben@mongodb.com', 'username': 'IamXander'}

Message: SERVER-76179 Add RuntimeDirectory to mongod.service for RPM
Branch: master
https://github.com/mongodb/mongo/commit/e968d9507a2d038004de32250ea62edaa627d39e

Comment by Chris Kelly [ 17/Apr/23 ]

Thanks for your report, tedi.roca@gmail.com!

This is related to SERVER-74345 which introduced a breaking change around --fork when using our Debian/RPM packages. We recently pushed SERVER-74845 to work around those breaking changes in 5.0.16, but this may be another issue we need to look into.

In your case, the processManagement.pidFilePath line can be removed from mongod.conf to correct the problem for now.

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