--- mongodb-src-r3.2.1/src/mongo/scripting/mozjs/implscope.cpp.orig +++ mongodb-src-r3.2.1/src/mongo/scripting/mozjs/implscope.cpp @@ -258,7 +258,13 @@ // // TODO: What if we are running on a platform with very // large pages, like 4MB? - JS_SetNativeStackQuota(_runtime, available.get() - (64 * 1024)); + //JS_SetNativeStackQuota(_runtime, available.get() - (64 * 1024)); + + // For musl libc: We adjust the reserved quota to 32k instead of + // 64k because the default musl libc thread stack size is small + // (80k) and we can not set stack size for C++ threads. + // Note also that with musl, stack size does not include guard page. + JS_SetNativeStackQuota(_runtime, available.get() - (32 * 1024)); } // The memory limit is in megabytes