[SERVER-40122] mongod generates inconsistent logs for journalctl during start up Created: 14/Mar/19  Updated: 27/Oct/23  Resolved: 10/Jun/19

Status: Closed
Project: Core Server
Component/s: Logging
Affects Version/s: 4.0.6
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Jia Hongchao Assignee: Mathew Robinson (Inactive)
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Steps To Reproduce:

1 on centos7 `yum install mongodb-org-server-4.0.6`

2 run `rm /etc/mongod.conf`

3 run `systemctl start mongod`

4 run `systemctl status mongod`

5 `Error reading config file: Permission denied` not always shown.They only appear if log entry has `_SYSTEMD_UNIT=mongod.service`

Sprint: Dev Tools 2019-04-08, Dev Tools 2019-04-22, Dev Tools 2019-06-17
Participants:

 Description   

When I try to start mongod on a centos server using  `systemctl start mongod`, mongod generates different format of logs for journalctl.
e.g.Sometimes I got _SYSTEMD_UNIT in logs sometimes I didn't.
use `journalctl -o verbose` to see following logs

Thu 2019-03-14 08:56:25.564626 CST [s=f346de34a07a4ae4864c0b0d59247e13;i=380;b=8d1b546e8233453eb811aad9c83b
PRIORITY=6
_SYSTEMD_SLICE=system.slice
_BOOT_ID=8d1b546e8233453eb811aad9c83b60d0
_MACHINE_ID=5e6521e7a19a4ceaa05ce7b123bdf8b2
_HOSTNAME=localhost.localdomain
SYSLOG_FACILITY=3
_TRANSPORT=stdout
_SELINUX_CONTEXT=system_u:system_r:init_t:s0
_CAP_EFFECTIVE=0
_STREAM_ID=4b9a978cc3dc46a0b498c309478cc055
SYSLOG_IDENTIFIER=mongod
MESSAGE=Error reading config file: Permission denied
_PID=941
_UID=998
_GID=995
_COMM=mongod
_SYSTEMD_CGROUP=/system.slice/mongod.service
_SYSTEMD_UNIT=mongod.service

or

Thu 2019-03-14 09:52:28.999450 CST [s=f346de34a07a4ae4864c0b0d59247e13;i=3c2;b=8d1b546e8233453eb811aad9c83b
PRIORITY=6
_BOOT_ID=8d1b546e8233453eb811aad9c83b60d0
_MACHINE_ID=5e6521e7a19a4ceaa05ce7b123bdf8b2
_HOSTNAME=localhost.localdomain
SYSLOG_FACILITY=3
_SYSTEMD_CGROUP=/
_TRANSPORT=stdout
_SELINUX_CONTEXT=system_u:system_r:init_t:s0
_CAP_EFFECTIVE=0
SYSLOG_IDENTIFIER=mongod
MESSAGE=Error reading config file: Permission denied
_UID=998
_GID=995
_COMM=mongod
_STREAM_ID=b21afa0dd80f44dca15370450b1be552
_PID=1644

and only those with `_SYSTEMD_UNIT=mongod.service` can be seen by `journalctl -u mongod` or 'systemctl status mongod'



 Comments   
Comment by Mathew Robinson (Inactive) [ 10/Jun/19 ]

Hey jiahongchao, so I finally tracked this one down.

This is actually a bug specific to RedHat's version of SystemD which has since been fixed. The relevant bugzilla bug is here.. They needed to apply the patch 0673-Revert-bus-when-dumping-string-property-values-escap.patch and they do so as of version systemd-219-62.el7_6.6.

Since this isn't a MongoDB bug and is specific to an edge case in RedHat's SystemD ( I have verified that versions of SystemD > 219 and >= the RH RPM version shown above do not have this problem ). I'm going to close this ticket as Works as Designed.

Comment by Jia Hongchao [ 10/Apr/19 ]

@Mathew Robinson

systemd 219
+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 -SECCOMP +BLKID +ELFUTILS +KMOD +IDN

Comment by Mathew Robinson (Inactive) [ 08/Apr/19 ]

Hey jiahongchao,

Can you post what version of SystemD you're using?

You can find this with:

systemctl --version

Thanks!

Comment by Jia Hongchao [ 20/Mar/19 ]

I wanted to edit it because "sometime" in "Sometime I got _SYSTEMD_UNIT in logs sometime I didn't" should be "Sometimes"

Comment by Danny Hatcher (Inactive) [ 19/Mar/19 ]

Hello,

Thank you for the report! I'm able to reproduce this behavior on my own system and this does appear to be a bug. I'll assign this ticket to the relevant team's backlog for them to triage and fix when possible.

BTY, why I can not edit my own issue here?

We restrict the ability of outside accounts from editing issue descriptions because we use them for our internal tracking. If you leave comments with the changes that you wish to make to the description, we can determine if it is necessary to add them in.

Thank you,

Danny

Comment by Jia Hongchao [ 14/Mar/19 ]

BTY, why I can not edit my own issue here?

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