[SERVER-36043] systemd unit for mongod starts before multi.user target Created: 10/Jul/18 Updated: 29/Oct/23 Resolved: 08/Aug/18 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Packaging |
| Affects Version/s: | None |
| Fix Version/s: | 3.4.22, 3.6.14, 4.1.2, 4.0.11 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Miguel Angel Nieto | Assignee: | Mathew Robinson (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | build-planned | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||
| Operating System: | ALL | ||||||||||||
| Backport Requested: |
v4.0
|
||||||||||||
| Sprint: | Build 2018-08-13 | ||||||||||||
| Participants: | |||||||||||||
| Case: | (copied to CRM) | ||||||||||||
| Story Points: | 1 | ||||||||||||
| Description |
|
The mongod service unit is configured to be part of the multi-user.target, but the unit configuration also has the following parameter: After=network.target Basically, this makes mongod start just after the network is up and not during multi-user (one of the latest targets to trigger). This causes problems on those servers where there are network storage services or authentication services (like AD) still pending to start. mongod would not be able to start if it depends on them. Removing the After parameter would make systemd to start mongod as part of the correct target. If an After is needed for some reason, After=multi-user.target would avoid most of the problems with dependencies between services. Affects all native packages (RPM and DEB) for systemd based Linux distros. |
| Comments |
| Comment by Connecting Media [ 09/Aug/19 ] |
|
@Mikko Tommila see SERVER 42603, which pointed out even worse problems with that change. And by now the change has been reverted and is expected to be released in 4.0.12. |
| Comment by Mikko Tommila [ 09/Aug/19 ] |
|
In a cloud deployment (e.g. AWS EC2) the cloud-init script runs before "multi-user.target". If the cloud-init script depends on MongoDB already running, then this change breaks the functionality when upgrading from 4.0.10 to 4.0.11. In version 4.0.10 the cloud-init just works, but in 4.0.11 the cloud-init waits for MongoDB to be available, but it will never be available, as MongoDB now only starts after the cloud-init script finishes. |
| Comment by Connecting Media [ 05/Aug/19 ] |
|
This is frankly incorrect. And in itself breaks and creates a cyclic dependency on itself. "After" doesn't control to which start group a service belongs. "WantedBy" does. And that is already set to "multi-user.target" The proper solution is that if you have services that need to start before mongod, add "Before=mongod.service" to their service files. The way mongod was started before was the recommended way and nothing needs to change. It is part of the correct start group and starting it after the "network.target" is also correct, because mongod needs networking to be available. So it was right before. And the misconfiguration is not on the Mongo side. |
| Comment by Githook User [ 07/Jun/19 ] |
|
Author: {'name': 'Mathew Robinson', 'email': 'chasinglogic@gmail.com', 'username': 'chasinglogic'}Message: (cherry picked from commit a014dce43e6f55fd6611a865902e46b34953ad72) |
| Comment by Githook User [ 07/Jun/19 ] |
|
Author: {'name': 'Mathew Robinson', 'email': 'chasinglogic@gmail.com', 'username': 'chasinglogic'}Message: (cherry picked from commit a014dce43e6f55fd6611a865902e46b34953ad72) |
| Comment by Githook User [ 07/Jun/19 ] |
|
Author: {'name': 'Mathew Robinson', 'email': 'chasinglogic@gmail.com', 'username': 'chasinglogic'}Message: (cherry picked from commit a014dce43e6f55fd6611a865902e46b34953ad72) |
| Comment by Githook User [ 08/Aug/18 ] |
|
Author: {'name': 'Mathew Robinson', 'email': 'chasinglogic@gmail.com', 'username': 'chasinglogic'}Message: |