Score:0

Alpine Linux on Docker: is it possible to configure the thread stack size?

it flag

I notice that an application (written in C++) is crashing on Alpine, with a segmentation fault.

After some investigation, it looks like the problem is the small thread stack size of Alpine.

The same problem, indeed, does NOT occur when running the same program on other official distribution images, like Debian.

Is it possible to configure the thread stack size of an Alpine-based docker image?

Score:2
br flag

The default thread stack size for threads created using the pthreads library in Alpine Linux is quite small, which can cause issues like the segmentation fault you're experiencing. To increase the thread stack size, you can set the PTHREAD_STACK_MIN environment variable to a larger value when building your Docker image.

FROM alpine:latest

ENV PTHREAD_STACK_MIN 2097152

# rest of the Dockerfile

we're setting PTHREAD_STACK_MIN to 2097152 bytes, which is 2MB. You can adjust this value to a size that works best for your application.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.