pthreads
pthreads copied to clipboard
Segmentation fault alpine linux
Environment
- PHP: 7.2.13
- pthreads: 3.2.0
- OS: linux, docker container
Summary
In alpine linux image:
- pthreads wokers pool + imagick in woker => Segmentation fault
- pthreads wokers pool <20 wokers + curl in woker => all fine
- pthreads wokers pool >30-40 wokers + curl => Segmentation fault
In debian linux image:
- pthreads wokers pool + imagick in woker => all fine
- pthreads wokers pool <20 wokers + curl in woker => all fine
- pthreads wokers pool >30-40 wokers + curl => all fine
(sorry im bad speack english)
Reproducing Code
In attachment file, completely environment, php code, example files.
Unpack, then run cmd:
- alpine
docker build -t alpine-pthreads .
docker run --rm alpine-pthreads
START single thread process
Single thread time: 40.1971
START multi thread process
Segmentation fault (core dumped)
- debian (all fine):
docker build -f ./Dockerfile.deb -t debian-pthreads .
docker run --rm debian-pthreads
START single thread process
Single thread time: 41.0055
START multi thread process
Multi thread time: 10.2270
Expected Output
No segmentation fault
Actual Output
Segmentation fault
If you install debug symbols and run it with gdb you might get a nice stack trace that could help. Note that curl comes with async support though imagick probably does not even if it might be just a proc wrapper.