# on musl the default thread stack size is ~80KiB, while glibc is 2MiB
# webkit-gtk doesn't expect this, and it's javascript engine uses alot of
# stack space, causing it run out of space and crash just after startup

diff --git a/Source/WTF/wtf/posix/ThreadingPOSIX.cpp b/Source/WTF/wtf/posix/ThreadingPOSIX.cpp
index 0ccc38c9d54b..f697a00a2fb6 100644
--- a/Source/WTF/wtf/posix/ThreadingPOSIX.cpp
+++ b/Source/WTF/wtf/posix/ThreadingPOSIX.cpp
@@ -304,6 +304,7 @@ bool Thread::establishHandle(NewThreadContext* context, std::optional<size_t> st
     pthread_t threadHandle;
     pthread_attr_t attr;
     pthread_attr_init(&attr);
+    pthread_attr_setstacksize(&attr, 2 * 1024 * 1024) // needed for musl
 #if HAVE(QOS_CLASSES)
     pthread_attr_set_qos_class_np(&attr, dispatchQOSClass(qos), 0);
 #endif
