1From ffe6045b190b735601cd209d3e7ac121604c5a4e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 24 Aug 2018 13:07:01 -0700
4Subject: [PATCH 08/10] Fix default stack size to 256K
5
6On musl default stack size is ~80K which is too low
7for mongodb
8
9Upstream-Status: Pending
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 src/mongo/platform/stack_locator_pthread_getattr_np.cpp | 10 ++++++++++
14 1 file changed, 10 insertions(+)
15
16diff --git a/src/mongo/platform/stack_locator_pthread_getattr_np.cpp b/src/mongo/platform/stack_locator_pthread_getattr_np.cpp
17index 4f3044c..68e47e3 100644
18--- a/src/mongo/platform/stack_locator_pthread_getattr_np.cpp
19+++ b/src/mongo/platform/stack_locator_pthread_getattr_np.cpp
20@@ -36,6 +36,16 @@
21 #include "mongo/util/assert_util.h"
22 #include "mongo/util/scopeguard.h"
23
24+__attribute__((constructor))
25+static void set_default_stack_size(void)
26+{
27+    pthread_attr_t attr;
28+    invariant(pthread_attr_init(&attr) == 0);
29+    invariant(pthread_attr_setstacksize(&attr, 256*1024) == 0);
30+    pthread_setattr_default_np(&attr);
31+    invariant(pthread_attr_destroy(&attr) == 0);
32+}
33+
34 namespace mongo {
35
36 StackLocator::StackLocator() {
37--
382.7.4
39
40