Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SIGSEGV on OSX #19

Open
dfeyer opened this issue Dec 1, 2017 · 12 comments
Open

SIGSEGV on OSX #19

dfeyer opened this issue Dec 1, 2017 · 12 comments

Comments

@dfeyer
Copy link

dfeyer commented Dec 1, 2017

[02-Dec-2017 00:15:55] WARNING: [pool www] child 1618 exited on signal 11 (SIGSEGV) after 55.787030 seconds from start

Is this a know issue ?

I use vips-8.5.9-Fri Dec 1 23:13:50 CET 2017

vips installed with brew and the php extension compile with pecl

OSX 10.13.1

Tested with PHP 7.1 and 7.2 it's pretty random, sometime everything work and it fast ... and sometimes just crash

Thanks

@jcupitt
Copy link
Member

jcupitt commented Dec 2, 2017

Oh dear, no, it should be stable. It's being used in production on quite a few sites and no one has reported anything like this.

Could you build with debugging on and get a stack trace on the segv? I could look over your code, if you're able to share it. If you can make a reproducible test-case, that would be best of all, of course.

@dfeyer
Copy link
Author

dfeyer commented Dec 4, 2017

I try to test the ext with Neos CMS (neos.io). The CMS offer CLI tools to (re)generate thumbnails, and those commands work great, but if the thumbnail are build during a web request, it crash sometimes, I try to debug a bit more to detect where the request crash in the system, if I found nothing, i will try to setup a PHP version with more debuging tools.

@dfeyer
Copy link
Author

dfeyer commented Dec 4, 2017

So after a bit of debugging the segv happens during the call of vips_foreign_find_load in \Jcupitt\Vips\Image::findLoad.

The value for the filename is /Users/dfeyer/Sites/dev/master-dev.neos-workplace.dev/Data/Temporary/Development/ResourceFiles/10d7e836208ca3c6ede4522fab117b63b6d8260c-1512419089.5465-45446.jpg (test with an without the file extension as the default behaviour of the CMS is to not use file extension for local temporary files, but same result)

→ vipsheader -f vips-loader /Users/dfeyer/Sites/dev/master-dev.neos-workplace.dev/Data/Temporary/Development/ResourceFiles/10d7e836208ca3c6ede4522fab117b63b6d8260c-1512419089.5465-45446.jpg
jpegload

@kleisauke
Copy link
Member

Is it a certain image (or image extension) that random crashes?

Or perhaps a 1x1 GIF image is being processed? If so, then it is fixed with https://github.com/jcupitt/libvips/issues/773.

@jcupitt
Copy link
Member

jcupitt commented Dec 5, 2017

Interesting! Does that image kill it every time? Could you send the file somehow?

@dfeyer
Copy link
Author

dfeyer commented Dec 5, 2017

@jcupitt I prepare a small script that process only this image, outside of the CMS, and I publish it if I can reproduce the error

@dfeyer
Copy link
Author

dfeyer commented Dec 5, 2017

My test project https://github.com/dfeyer/php-vips-ext-test

So the problem seems related to my setup, from the CLI it work nicely, for a web request (Caddy Server + PHP-FPM, configuration included in the repo) it crash

→ php Web/index.php Vips
Driver: Vips
Runtime: 359 ms
Memory usage: 2 MiB (real)
Memory usage: 0.90319061279297 MiB
Generated file size: 61.6318359375 KiB%

→ php Web/index.php Imagick
Driver: Imagick
Runtime: 4100 ms
Memory usage: 2 MiB (real)
Memory usage: 0.74958801269531 MiB
Generated file size: 25.8740234375 KiB%

→ php Web/index.php Gd
Driver: Gd
Runtime: 1137 ms
Memory usage: 306.15234375 MiB (real)
Memory usage: 304.74176025391 MiB
Generated file size: 24.0263671875 KiB%

From a web request:

Works fine:
http://localhost:8180/index.php?driver=Gd
http://localhost:8180/index.php?driver=Vips

Segv:
http://localhost:8180/index.php?driver=Vips

Trying to output a phpinfo, work from the CLI, segv from a web request ...

@jcupitt
Copy link
Member

jcupitt commented Dec 5, 2017

It seems to work for me from the CLI, but I can't get caddy to cooperate, some error about a bad gateway.

I think your CaddyFile needs to be renamed as Caddyfile, or it'll fail on a case-sensitive system.

$ ~/caddy/caddy
Activating privacy features... done.
NOTICE: Startup directive will be removed in a later version. Please migrate to 'on startup'
NOTICE: Shutdown directive will be removed in a later version. Please migrate to 'on shutdown'
http://*:8180
WARNING: File descriptor limit 1024 is too low for production servers. At least 8192 is recommended. Fix with "ulimit -n 8192".
127.0.0.1 - - [05/Dec/2017:16:31:26 +0000] "GET / HTTP/1.1" 404 38
05/Dec/2017:16:31:27 +0000 [ERROR 502 /index.php] dial tcp 127.0.0.1:9000: getsockopt: connection refused

I'll keep trying.

@dfeyer
Copy link
Author

dfeyer commented Dec 5, 2017

@jcupitt this command should be fine to launch caddy

caddy --conf CaddyFile --root Web

You need to adapt the path to your PHP FPM binary in the CaddyFile configuration, I use PHP OSX
(https://php-osx.liip.ch/), this command work just fine (the wrapper is used to auto select the current PHP version on my machine) :

/usr/local/php5/sbin/php-fpm --fpm-config /usr/local/php5/etc/php-fpm.d/www.conf.default

And BTW thanks a lots for your support 👍

@dfeyer
Copy link
Author

dfeyer commented Dec 7, 2017

[www]
user = nobody
group = nobody
listen = 127.0.0.1:9000
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3

The content of my PHP FPM configuration file

@kleisauke
Copy link
Member

I couldn't reproduce the segv with Caddy + PHP-FPM + PHP 7.2 + libvips 8.5.9 on CentOS 7.4. I was able to successfully create the thumbnail from CLI and web.

BTW,
I noticed php5 in your previous message (and in the CaddyFile). Is this on purpose? The binary extension and PHP wrapper only works on PHP 7+.

@dfeyer
Copy link
Author

dfeyer commented Dec 7, 2017

I noticed php5 in your previous message (and in the CaddyFile). Is this on purpose? The binary extension and PHP wrapper only works on PHP 7+.

It's just a symlink php5 but yes I use PHP 7.0, 7.1 and 7.2 ... and same crash for all the version. So it's something related to OSX or the php build from http://php-osx.liip.ch/ ... I try this morning to have debug build of PHP ... but failed dramaticaly ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants