[SERVER-35646] MozJSImplScope::buildStackString() segfaults when using clang-6.0 Created: 18/Jun/18  Updated: 27/Oct/23  Resolved: 31/Jan/19

Status: Closed
Project: Core Server
Component/s: Build, JavaScript
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Max Hirschhorn Assignee: Andrew Morrow (Inactive)
Resolution: Gone away Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-39098 Show JS stacktrace when the test hangs Closed
Operating System: ALL
Steps To Reproduce:

# Compile the mongo shell using clang-6.0. This line was adapted from the "compile_flags" expansion
# of the Enterprise Ubuntu 18.04 (System clang 6.0 C++17 libc++ DEBUG) builder. Note that neither
# --libc++ nor --cxx-std=17 are necessary to make the mongo shell segfault when the
# MozJSImplScope::buildStackString() function is called.
/opt/mongodbtoolchain/v2/bin/python2 buildscripts/scons.py --dbg=on --opt=on --ssl -j$(grep -c ^processor /proc/cpuinfo) CC=clang-6.0 CXX=clang++-6.0 --disable-warnings-as-errors --allocator=system CPPDEFINES=_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR CXXFLAGS="-Wno-register" mongo
 
# Run the mongodb-javascript-stack GDB command.
/opt/mongodbtoolchain/v2/bin/python2 buildscripts/hang_analyzer.py

Sprint: Dev Tools 2018-12-31, Dev Tools 2019-01-14, Dev Tools 2019-01-28, Dev Tools 2019-02-11
Participants:
Linked BF Score: 45

 Description   

The MozJSImplScope::buildStackString() function is used to make the hang_analyzer.py script log the JavaScript stacktrace at the time the test has hung. We shouldn't upgrade the MongoDB toolchain to clang-6.0 if it is going to reduce the diagnostics that are available to a Server engineer when an Evergreen task times out.

[JSTest:0] 2018-06-16T17:57:06.460+0000 2018-06-16T17:57:06.460+0000 F -        [js] Invalid access at address: 0x8528
[JSTest:0] 2018-06-16T17:57:06.464+0000 2018-06-16T17:57:06.464+0000 F -        [js] Got signal: 11 (Segmentation fault).
[JSTest:0] 2018-06-16T17:57:06.464+0000  0x5632e1bd2378 0x5632e1bd1ebb 0x7fcaec17d890 0x5632e139b7b4 0x5632e136cc7d 0x5632e0fda03f 0x5632e0ff6de4 0x5632e0fe9856 0x7fcae9016caf
[JSTest:0] 2018-06-16T17:57:06.464+0000 ----- BEGIN BACKTRACE -----
[JSTest:0] 2018-06-16T17:57:06.464+0000 {"backtrace":[{"b":"5632E08D1000","o":"1301378","s":"_ZN5mongo15printStackTraceERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEE"},{"b":"5632E08D1000","o":"1300EBB"},{"b":"7FCAEC16B000","o":"12890"},{"b":"5632E08D1000","o":"ACA7B4","s":"_ZN2js18IsAtomsCompartmentEP13JSCompartment"},{"b":"5632E08D1000","o":"A9BC7D","s":"_Z22JS_GetPendingExceptionP9JSContextN2JS13MutableHandleINS1_5ValueEEE"},{"b":"5632E08D1000","o":"70903F","s":"_ZN5mongo5mozjs23throwCurrentJSExceptionEP9JSContextNS_10ErrorCodes5ErrorENS_10StringDataE"},{"b":"5632E08D1000","o":"725DE4","s":"_ZN5mongo5mozjs15JSStringWrapperC1EP9JSContextP8JSString"},{"b":"5632E08D1000","o":"718856","s":"_ZN5mongo5mozjs14MozJSImplScope16buildStackStringEv"},{"b":"0","o":"7FCAE9016CAF"}],"processInfo":{ "mongodbVersion" : "4.1.0-365-g6fb6f415d0", "gitVersion" : "6fb6f415d02017e6588e4a8206de41cc8756f52e", "compiledModules" : [ "enterprise" ], "uname" : { "sysname" : "Linux", "release" : "4.15.0-1007-aws", "version" : "#7-Ubuntu SMP Tue Apr 24 10:56:17 UTC 2018", "machine" : "x86_64" }, "somap" : [ { "b" : "5632E08D1000", "elfType" : 3, "buildId" : "0E3EEBD618CB24BD1194B4CB90094C9C50BE8221" }, { "b" : "7FFCD26BE000", "path" : "linux-vdso.so.1", "elfType" : 3, "buildId" : "59A6FE5AA4F091833EB2933E0A94376880391E63" }, { "b" : "7FCAEDB3C000", "path" : "/usr/lib/x86_64-linux-gnu/libsasl2.so.2", "elfType" : 3, "buildId" : "ABB7E3F40302E6509DAD1F91DFB1F04B6A5FD072" }, { "b" : "7FCAED79E000", "path" : "/lib/x86_64-linux-gnu/libm.so.6", "elfType" : 3, "buildId" : "A33761AB8FB485311B3C85BF4253099D7CABE653" }, { "b" : "7FCAED583000", "path" : "/lib/x86_64-linux-gnu/libresolv.so.2", "elfType" : 3, "buildId" : "390E9CC4C215314B6D8ADE6D6E28F8518418039C" }, { "b" : "7FCAED10B000", "path" : "/usr/lib/x86_64-linux-gnu/libcrypto.so.1.1", "elfType" : 3, "buildId" : "95C6AB96CFE61B3B896F617C963E75A1ABAA99AC" }, { "b" : "7FCAECEA1000", "path" : "/usr/lib/x86_64-linux-gnu/libssl.so.1.1", "elfType" : 3, "buildId" : "9787FF1FFFE8D82268D89F6BFA3AF07B3E9D140F" }, { "b" : "7FCAECC9D000", "path" : "/lib/x86_64-linux-gnu/libdl.so.2", "elfType" : 3, "buildId" : "25AD56E902E23B490A9CCDB08A9744D89CB95BCC" }, { "b" : "7FCAECA95000", "path" : "/lib/x86_64-linux-gnu/librt.so.1", "elfType" : 3, "buildId" : "9826FBDF57ED7D6965131074CB3C08B1009C1CD8" }, { "b" : "7FCAEC7D2000", "path" : "/usr/lib/x86_64-linux-gnu/libc++.so.1", "elfType" : 3 }, { "b" : "7FCAEC5A2000", "path" : "/usr/lib/x86_64-linux-gnu/libc++abi.so.1", "elfType" : 3 }, { "b" : "7FCAEC38A000", "path" : "/lib/x86_64-linux-gnu/libgcc_s.so.1", "elfType" : 3, "buildId" : "039AE85FEF075EC14FE3528762A0645C8CF73B29" }, { "b" : "7FCAEC16B000", "path" : "/lib/x86_64-linux-gnu/libpthread.so.0", "elfType" : 3, "buildId" : "28C6AADE70B2D40D1F0F3D0A1A0CAD1AB816448F" }, { "b" : "7FCAEBD7A000", "path" : "/lib/x86_64-linux-gnu/libc.so.6", "elfType" : 3, "buildId" : "B417C0BA7CC5CF06D1D1BED6652CEDB9253C60D0" }, { "b" : "7FCAEDD57000", "path" : "/lib64/ld-linux-x86-64.so.2", "elfType" : 3, "buildId" : "64DF1B961228382FE18684249ED800AB1DCEAAD4" } ] }}
[JSTest:0] 2018-06-16T17:57:06.464+0000  mongo(_ZN5mongo15printStackTraceERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEE+0x38) [0x5632e1bd2378]
[JSTest:0] 2018-06-16T17:57:06.465+0000  mongo(+0x1300EBB) [0x5632e1bd1ebb]
[JSTest:0] 2018-06-16T17:57:06.465+0000  libpthread.so.0(+0x12890) [0x7fcaec17d890]
[JSTest:0] 2018-06-16T17:57:06.465+0000  mongo(_ZN2js18IsAtomsCompartmentEP13JSCompartment+0x4) [0x5632e139b7b4]
[JSTest:0] 2018-06-16T17:57:06.465+0000  mongo(_Z22JS_GetPendingExceptionP9JSContextN2JS13MutableHandleINS1_5ValueEEE+0x2D) [0x5632e136cc7d]
[JSTest:0] 2018-06-16T17:57:06.465+0000  mongo(_ZN5mongo5mozjs23throwCurrentJSExceptionEP9JSContextNS_10ErrorCodes5ErrorENS_10StringDataE+0x4F) [0x5632e0fda03f]
[JSTest:0] 2018-06-16T17:57:06.465+0000  mongo(_ZN5mongo5mozjs15JSStringWrapperC1EP9JSContextP8JSString+0xA4) [0x5632e0ff6de4]
[JSTest:0] 2018-06-16T17:57:06.465+0000  mongo(_ZN5mongo5mozjs14MozJSImplScope16buildStackStringEv+0xD6) [0x5632e0fe9856]
[JSTest:0] 2018-06-16T17:57:06.465+0000  ??? [0x7fcae9016caf]
[JSTest:0] 2018-06-16T17:57:06.465+0000 -----  END BACKTRACE  -----



 Comments   
Comment by Andrew Morrow (Inactive) [ 31/Jan/19 ]

I've followed the reproduction instructions here with V3 gcc and clang. As long as I use the toolchain v3 gdb as well, I am able to extract the JS stack without crashes. I've not gone back and tried to identify whether it was the toolchain upgrade or the MozJS upgrade that fixed it. I'm closing this as gone away, but please feel free to re-open it if you find it starts happening again when consistently using the V3 tools and we will be happy to investigate further.

Comment by Eric Milkie [ 18/Jun/18 ]

What might need to happen is to upgrade SpiderMonkey. I see that they're now up to version 50, and we are currently on version 45.

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