[SERVER-23481] How to enable mongod coredump? Created: 02/Apr/16  Updated: 15/Nov/21  Resolved: 07/Apr/16

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: None

Type: Question Priority: Trivial - P5
Reporter: Zhang Youdong Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-21635 No coredump on Linux when starting wi... Backlog
Participants:

 Description   

I want to generate corefile when mongod received SIGSEGV to help debuging, but even I comment the signal binding code and recompile, mongod cannot dump corefile when SIGSEGV received, can you guys tell me why? Thanks a lot.

diff src/mongo/util/signal_handlers_synchronous.cpp

-        invariant(sigaction(SIGSEGV, &addrSignals, nullptr) == 0);
-        invariant(sigaction(SIGBUS, &addrSignals, nullptr) == 0);
+        //invariant(sigaction(SIGSEGV, &addrSignals, nullptr) == 0);
+        //invariant(sigaction(SIGBUS, &addrSignals, nullptr) == 0);

PS: Another program compiler by the same gcc on the same host can generate corefile when SIGSEGV received.

 
$ulimit -c
unlimited
 



 Comments   
Comment by Bruce Lucas (Inactive) [ 07/Apr/16 ]

Glad to hear that you tracked the issue down. You are probably already aware of this, but the location of core files can be controlled by /proc/sys/kernel/core_pattern.

Comment by Zhang Youdong [ 07/Apr/16 ]

Thanks a lot, I have got the reason.

after mongod started with fork option set to true, it chdir("/") to root dir. mongod started by normal user have no permission to write "/", so no core files are dumped.

Comment by Bruce Lucas (Inactive) [ 06/Apr/16 ]

zyd_com, have you checked system logs to see if abrtd (or similar) has done something with the core file, e.g. move it to /var/spool/abrt, or delete it? Depending on how it's configured, it may behave differently for installed and uninstalled programs. (Preceding applies to EL, but I believe there may be something similar in Ubuntu.)

Comment by Zhang Youdong [ 06/Apr/16 ]

hi, Andy Schwerin, Can you help me figure out this problem, it's really important to me.

Comment by Zhang Youdong [ 03/Apr/16 ]

Thank you for your reply, I am using MongoDB-3.2.3.

Why "it's unnecessary for version 3.2.0 and above" ? and what should I do to enable core dump when received SIGSEGV in 3.2.0?

Comment by Andy Schwerin [ 02/Apr/16 ]

What version of MongoDB? Your patch should be unnecessary for version 3.2.0 and above, and should have been sufficient for prior versions.

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