1

I don't know what happended, but whenever a user tries to register himself on one of my phpBB forums nginx throws 502 Bad gateway, but if I disable OPcache everything works fine.

This is the error log from php-fpm:

WARNING: [pool www] child 14677 exited on signal 11 (SIGSEGV) after 87782.968736 seconds from start

And this is the nginx error log:

[error] 14099#0: *78984 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: x.x.x.x, server: x, request: "POST /ucp.php?mode=register HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "x.tld", referrer: "https://x.tld/ucp.php?mode=register"

Pagespeed is enabled on all of my hosts as well as varnish.

Vhost config:

[...]

# PageSpeed
pagespeed on;

pagespeed MemcachedThreads 1;
pagespeed MemcachedServers "localhost:11211";

#Varnish
pagespeed DownstreamCachePurgeLocationPrefix https://x.tld:80;
pagespeed DownstreamCachePurgeMethod PURGE;
pagespeed DownstreamCacheRewrittenPercentageThreshold 95;

pagespeed EnableFilters combine_javascript;
pagespeed EnableFilters combine_css;
pagespeed EnableFilters move_css_above_scripts;
pagespeed EnableFilters prioritize_critical_css;
pagespeed FileCachePath              "/var/cache/pagespeed/";
pagespeed MapRewriteDomain https://x.tld http://x.tld;

[...]

location ~ \.php$ {
  include fastcgi_params;
  fastcgi_index index.php;
  fastcgi_pass   unix:/var/run/php5-fpm.sock;
  fastcgi_split_path_info ^(.+\.php)(/.+)$;
}

OPcache config:

[opcache]
opcache.enable=1
opcache.enable_cli=1
opcache.memory_consumption=512
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=30000
opcache.max_wasted_percentage=5
opcache.use_cwd=1
opcache.validate_timestamps=1
opcache.revalidate_freq=1
opcache.fast_shutdown=1
opcache.optimization_level=0

I tried to blacklist the whole forum dir, but it only works if I fully disable OPcache

Edit:

Using PHP 5.6.5-1~dotdeb.1 on Debian GNU/Linux 7.8 Varnish 4.0.2

Edit2:

Disabled pagespeed and tried xcache nginx reports 503 and the php-fpm worker restarts.
It only works if I fully disable caching in php

Edit3:

After making a core dump as Jakov Sosic suggested, this is the result:

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `php-fpm: pool www                                                     '.
Program terminated with signal 11, Segmentation fault.
#0  _zend_mm_free_int (heap=0xf122c0, p=0x7f895b07c980) at /usr/src/php5.6/nonzts/source/dotdeb-php5/Zend/zend_alloc.c:2104
2104    /usr/src/php5.6/nonzts/source/dotdeb-php5/Zend/zend_alloc.c: No such file or directory.
Octfx
  • 283
  • 1
  • 2
  • 7

2 Answers2

1

One way you could try and tackle the problem is to fetch a coredump of PHP (after it segfaults), and then analyse coredump with GDB (with debuginfo packages installed on system). Then you could possible see what exact php line is giving you headache.

Other then that - there's not much anyone can advise you on this one.

http://www.omh.cc/blog/2008/mar/6/fixing-apache-segmentation-faults-caused-php/

Jakov Sosic
  • 5,267
  • 4
  • 24
  • 35
0

After inspecting the issue I found out, that the opcache error was triggered by an missing file, but that was not the problem.
My php-version was installed without the zend thread safety feature. After installing php with zts everything is working fine now.

Octfx
  • 283
  • 1
  • 2
  • 7