Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 1 | From 98543889f7ba38c02eb7cd9822f45e27d619edd6 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Fri, 24 Aug 2018 13:07:01 -0700 |
| 4 | Subject: [PATCH 2/2] Fix default stack size to 256K |
| 5 | |
| 6 | On musl default stack size is ~80K which is too low |
| 7 | for mongodb |
| 8 | |
| 9 | Upstream-Status: Pending |
| 10 | |
| 11 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 12 | --- |
| 13 | .../platform/stack_locator_pthread_getattr_np.cpp | 10 ++++++++++ |
| 14 | 1 file changed, 10 insertions(+) |
| 15 | |
| 16 | diff --git a/src/mongo/platform/stack_locator_pthread_getattr_np.cpp b/src/mongo/platform/stack_locator_pthread_getattr_np.cpp |
| 17 | index 648d26a41c..6e398f00c9 100644 |
| 18 | --- a/src/mongo/platform/stack_locator_pthread_getattr_np.cpp |
| 19 | +++ b/src/mongo/platform/stack_locator_pthread_getattr_np.cpp |
| 20 | @@ -35,6 +35,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 | -- |
| 38 | 2.18.0 |
| 39 | |