Bug #78125 [Asn->Fbk]: Persistent php-cgi.exe access fault

From: Date: Tue, 25 Jun 2019 08:42:48 +0000
Subject: Bug #78125 [Asn->Fbk]: Persistent php-cgi.exe access fault
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-221475@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78125&edit=1

 ID:                 78125
 Updated by:         cmb@php.net
 Reported by:        aschmidt at anamera dot net
 Summary:            Persistent php-cgi.exe access fault
-Status:             Assigned
+Status:             Feedback
 Type:               Bug
 Package:            opcache
 Operating System:   Win x64
 PHP Version:        7.3.8-dev
 Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

Please try with PHP 7.3.7RC3 (<https://windows.php.net/qa/#php-7.3>).


Previous Comments:
------------------------------------------------------------------------
[2019-06-19 00:19:13] aschmidt at anamera dot net

The most functional environment is:
7.3.6 or 7.2.19
WITH WinCache
WITH OpCache
BUT opcache.enable_cli=0   !!!

In THAT combination:
- php-cli will work (uncached), 
- php-cgi will work (cached), 
- phpinfo(8) will work.

------------------------------------------------------------------------
[2019-06-19 00:07:25] aschmidt at anamera dot net

phpinfo( 8 ) FAILS with php-7.3-nts-windows-vc15-x64-r11b354d
- even without OPcache, Wincache
but WORKS fine with php 7.3.6

(So the same phpinfo(8) problem as with 7.2, fails after 7.2.19).


Concurrent php-cli and php-cgi with OPcache crashes:
php-7.3-nts-windows-vc15-x64-r11b354d
7.3.6, 7.3.5, 7.3.4
It does NOT matter if wincache extension is removed. 


However, concurrent php-cli and php-cgi WORKS with wincache in all those 7.3.x, as soon as OPcache
is removed.

Sorry - testing with different permissions/users is not practical, because the php-cli service and
the php-cgi web site rely on certain network shares that require certain privileges.

------------------------------------------------------------------------
[2019-06-18 08:14:46] cmb@php.net

Thanks for further checking!  I have some further questions which
may help to localize the problem:

* Did neither of the two issues occur with 7.3.5?

* Which exact revision of 7.3.8-dev did you test?  Was it
  r9f0515c?

* Can you reproduce the two issues without Xdebug and Wincache?

* What happens when you run FCGI and the CLI service under
  different user accounts?

------------------------------------------------------------------------
[2019-06-18 05:37:32] aschmidt at anamera dot net

Just also tested 7.3.6 up to 7.3.8-dev. BOTH problems are open:

a) the php-cgi crashes whenever OPcache is enabled! 

b) phpinfo(8) crashes unconditionally, but phpinfo(55) will work.

So at this point, there appears that neither the current, nor any upcoming version supports OPcache
under Windows - and I'm worried that phpinfo(8) is failing?

------------------------------------------------------------------------
[2019-06-15 08:12:15] cmb@php.net

Thanks for the further investigation!

> OPcache IGNORES the PHP.ini "sys_temp_dir" value!

Indeed.  On Windows it uses GetTempPath() instead.

On Windows, Opcache has a single Opcache instance (shared memory)
per User and PHP version.  To manage this instance, it uses the
MemoryBase file.  In the given case, starting FCGI for the first
time will create the Opcache instance, and the MemoryBase file
like you have described.  When the CLI service is started, the
Opcache instance is found, but attaching is not possible, because
the MemoryBase file is not found, so the process terminates.
Shutting down FCGI will cause the Opcache instance to be destroyed.
Afterwards the CLI service can be started, and it creates a new
Opcache instance and MemoryBase file.  If FCGI is started
afterwards, the Opcache instance is found, and the old MemoryBase
file as well, so attaching is successful if the contents of both
MemoryBase files are identical.

> There are TWO ways to work around this issue:

If I'm not mistaken, there is at least a third work-around, namely
to copy FCGI's MemoryBase file to where the CLI process expects
it, before starting the CLI process.

It might be worthwhile to pursue fixing this (i.e. use the same
MemoryBase file), but perhaps a better alternative might be to
facilitate to actually have multiple Opcache instances per user
and PHP version when needed.  There is a draft[1], but it is not
yet sufficiently tested.

To avoid confusion: most of the explanations above refer to
Opcache on Windows only, and they are rather simplified.

[1] <https://github.com/cmb69/php-src/tree/opcache.cache_id>

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=78125


--
Edit this bug report at https://bugs.php.net/bug.php?id=78125&edit=1


Thread (16 messages)

« previous php.bugs (#221475) next »