[SERVER-71608] Segmentation fault: in mongo::LockManager::lock Created: 24/Nov/22 Updated: 29/Oct/23 Resolved: 14/Feb/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | 6.0.2, 6.0.3 |
| Fix Version/s: | 7.0.0-rc0, 6.0.5 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | R K | Assignee: | Mark Benvenuto |
| Resolution: | Fixed | Votes: | 3 |
| Labels: | crash, segfault | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||||||||||
| Issue Links: |
|
||||||||||||||||
| Assigned Teams: |
Server Development Platform
|
||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||
| Operating System: | ALL | ||||||||||||||||
| Backport Requested: |
v6.0
|
||||||||||||||||
| Steps To Reproduce: | Build and run MongoDB 6.0.2 or 6.0.3 on FreeBSD amd64 or aarch64 and it segfaults after startup. I'm maintaining ports of MongoDB 4.2 to 5.0 on FreeBSD and they run fine. Attached the mongodb60.log |
||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
After startup of MongoDB 6.0 the server gets a segmentation fault.
|
| Comments |
| Comment by Pawel Kraszewski [ 22/Feb/23 ] | |||||||||||||||||||||||||||
|
I can confirm, FreeBSD 13.1-RELEASE-p6 can run mongodb60-6.0.4_1 built from ports on a default configuration. Thank you. | |||||||||||||||||||||||||||
| Comment by R K [ 17/Feb/23 ] | |||||||||||||||||||||||||||
|
thank you for the time, effort and fix | |||||||||||||||||||||||||||
| Comment by Githook User [ 15/Feb/23 ] | |||||||||||||||||||||||||||
|
Author: {'name': 'Mark Benvenuto', 'email': 'mark.benvenuto@mongodb.com', 'username': 'markbenvenuto'}Message: (cherry picked from commit c419698b577f7924d2d6fc6bd3f7bd922f1d0dd7) | |||||||||||||||||||||||||||
| Comment by Githook User [ 14/Feb/23 ] | |||||||||||||||||||||||||||
|
Author: {'name': 'Mark Benvenuto', 'email': 'mark.benvenuto@mongodb.com', 'username': 'markbenvenuto'}Message: | |||||||||||||||||||||||||||
| Comment by Mark Benvenuto [ 10/Feb/23 ] | |||||||||||||||||||||||||||
|
Sorry for the delay. This issue was recently bought to my intention. This issue appear a little bizarre at first but was caused by issues with MozJS on FreeBSD. This would show up as random memory corruption in various mongo programs that used MozJS. The test javascript shell would not even start before crashing. Valgrind was very helpful in ultimately finding the issue. In the 6.0 timeframe, we upgraded to a new MozJS and for some reason, it depends on a quirk of our memory allocator (see https://github.com/mongodb/mongo/blob/master/src/mongo/scripting/mozjs/jscustomallocator.cpp#L40-L48) which is not implemented in the FreeBSD port. After implementing this support, MongoD and Mongo appear to work fine. I also switched the memory allocator to using the FreeBSD memory allocator (--allocator=system) because FreeBSD used jemalloc (it is just as good as gperftools). I will make this fix to master (and a few other portability fixes) and then backport them to 6.0. Output snippet from valgrind:
| |||||||||||||||||||||||||||
| Comment by Eric Pierce [ 09/Feb/23 ] | |||||||||||||||||||||||||||
|
I hope this helps pinpoint research on this, as I would very much like to see this working as well. I was able to get 6.0.2 running on FreeBSD (13.1-p5) by adding the mongo user to the wheel group. Perhaps a minor/subtle permissions issue? I don't have much I can offer in the way of logs since it's been 2-3 weeks since I set this up, though I'd be happy to provide anything I can to further pinpoint if needed. Since that time, it's been up and running without issue. My mongo instance isn't under heavy load (I use it for Graylog metadata, but it's been stable and no issues since I made that change). | |||||||||||||||||||||||||||
| Comment by Pawel Kraszewski [ 24/Jan/23 ] | |||||||||||||||||||||||||||
|
As to "needs verification" tag to the problem: mongodb60 has been removed from FreeBSD binary repositories and the official source port has been marked as "IGNORE". I can't imagine of a better verification than a takedown from the official maintainers... | |||||||||||||||||||||||||||
| Comment by Pawel Kraszewski [ 02/Jan/23 ] | |||||||||||||||||||||||||||
|
I can confirm the problem on 2 different FreeBSD 13.1 installations (one totally fresh), with repository-default MongoDB 6.0.2, and a distribution-default configuration file. I gathered truss log (FreeBSD's equivalent of strace), it is attached with the matching mongod.log - I hope this will shed some light on the problem. |