RE: SHM issues PHP7 x64
[email protected] (Anatol Belski) Thu, 13 Apr 2017 14:09:09 +0000
| Newsgroups | php.internals.win |
|---|---|
| Message-ID | <HE1PR02MB105227706FAB132770F106FDBA020@HE1PR02MB1052.eurprd02.prod.outlook.com> |
Hi Jan, > -----Original Message----- > From: Jan Ehrhardt [mailto:[email protected]] > Sent: Thursday, April 13, 2017 12:07 PM > To: [email protected] > Subject: SHM issues PHP7 x64 > > There is a reproducable SHM issue with php_apcu.dll in PHP 7 NTS x64: > https://github.com/krakjoe/apcu/issues/223#issuecomment-288202260 > > I thought that could be due to the special method that apcu uses to create a > SHM block. It directly loads ntdll.dll: > https://github.com/krakjoe/apcu/blob/master/apc_windows_srwlock_kernel.c# > L63 > > I tried to reproduce this issue on AppVeyor, but failed: > https://github.com/krakjoe/apcu/pull/240 > > My conclusion at that time was, that php_apcu.dll is broken on x64. In > PHP7 only, because it works perfectly in PHP 5.6. > > But today I ran into an issue that seems related. On a Windows 2008 R2 > (development) server I am running Apache/2.4.25 (Win64) PHP/7.1.4 > OpenSSL/1.0.2k-fips mod_fcgid/2.3.9. > > The server is really low traffic. There is a Drupal 7 site running on it with me as > the only user. Drupal 7 runs with PHP 7.1.4 NTS x64 under mod_fcgid, without > php_apcu.dll. > > The site reproduced Internal server errors 500 today. Nothing in the logs except > that "the pipe had been ended", indicating that php-cgi.exe did not return > anything to mod_fcgid. Then I checked eventvrw.msc. Error message in Zend > OPcache: > > |Base address marks unusable memory region. Please setup > |opcache.file_cache and opcache.file_cache_fallback directives for more > |convenient Opcache usage > | Attempt to access invalid address > > This error message is SHM related as well, according to Anatol: > http://markmail.org/message/hhieta6jpzocnvll#query:+page:1+mid:cyq7g7fcibu > nrdr2+state:results > > I cannot easily reproduce the Error 500 on my Win2k8 server. They disappeared > after the php-cgi.exe instance had been killed by Apache: > > [Thu Apr 13 10:17:55.795816 2017] [fcgid:warn] [pid 7264:tid 828] > mod_fcgid: process 5604 graceful kill fail, sending SIGKILL > > But the problem with php_apcu.dll is reproducable on my Win7 Pro laptop and > on the Win2k8 server. > https://github.com/krakjoe/apcu/pull/240#issuecomment-288365944 > > Ugly problem. Is there anything I can do to get it solved? Thanks for the investigations so far. The two listed cases are unrelated. The Opcache error is the known issue which is worked around by the exact suggestion from the error message. In most case it's conditioned by ASLR and the workaround reduces the failures to almost zero. You might try to disable ASLR for the PHP build, however it in many cases won't work as Windows itself will enforce it. With APCu, I'd like to point you to this issue https://github.com/krakjoe/apcu/issues/67#issuecomment-164926913. The issue in APCu is in most case the locking, so not all the processing modes are supported. Particularly on Windows, you should ensure there's no inter process cache sharing, as the locking is not suitable for such model. While the Opcache behavior wrt the issue is sporadic and system conditioned, the APCu one is clearly about the SAPIs and their limitations. Anyway, they should not be mixed up, as they're completely different matters. I see, that your primary interest is about APCu, so you might check in further whether the crash conditions involve inter process SHM access, which would require inter process locking that is currently absent in APCu. Regards Anatol