From 471108f2e4b1b9ed56d9d14dfd4531401cea5679 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Mon, 30 Jan 2017 08:01:36 -0800 Subject: Slightly increase thread stack size for safety (primary Alpine related) possibly GitHub #443 --- node/Constants.hpp | 5 +++++ osdep/Thread.hpp | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/node/Constants.hpp b/node/Constants.hpp index ac1919b3..a73d4d89 100644 --- a/node/Constants.hpp +++ b/node/Constants.hpp @@ -419,6 +419,11 @@ #define ZT_UDP_DESIRED_BUF_SIZE 131072 #endif +/** + * Desired / recommended min stack size for threads (used on some platforms to reset thread stack size) + */ +#define ZT_THREAD_MIN_STACK_SIZE 1048576 + /* Ethernet frame types that might be relevant to us */ #define ZT_ETHERTYPE_IPV4 0x0800 #define ZT_ETHERTYPE_ARP 0x0806 diff --git a/osdep/Thread.hpp b/osdep/Thread.hpp index 9f6fb5a8..227c2cfe 100644 --- a/osdep/Thread.hpp +++ b/osdep/Thread.hpp @@ -28,6 +28,7 @@ #include #include #include + #include "../node/Mutex.hpp" namespace ZeroTier { @@ -128,7 +129,7 @@ public: pthread_attr_init(&_tattr); // This corrects for systems with abnormally small defaults (musl) and also // shrinks the stack on systems with large defaults to save a bit of memory. - pthread_attr_setstacksize(&_tattr,524288); + pthread_attr_setstacksize(&_tattr,ZT_THREAD_MIN_STACK_SIZE); _started = false; } -- cgit v1.2.3