krakjoe / pthreads

Threading for PHP - Share Nothing, Do Everything :)
Other
3.47k stars 501 forks source link

Segmentation fault alpine linux #912

Open vGhost2000 opened 5 years ago

vGhost2000 commented 5 years ago

Environment

Summary

In alpine linux image: 1) pthreads wokers pool + imagick in woker => Segmentation fault 2) pthreads wokers pool <20 wokers + curl in woker => all fine 3) pthreads wokers pool >30-40 wokers + curl => Segmentation fault

In debian linux image: 1) pthreads wokers pool + imagick in woker => all fine 2) pthreads wokers pool <20 wokers + curl in woker => all fine 3) 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.

test.tar.gz

Unpack, then run cmd: 1) 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) 

2) 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

joeyhub commented 5 years ago

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.