Bug #79003 [Com]: Cannot use `exit` in preloading script

From: Date: Fri, 20 Dec 2019 12:43:01 +0000
Subject: Bug #79003 [Com]: Cannot use `exit` in preloading script
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-224445@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79003&edit=1

 ID:                 79003
 Comment by:         bugreports at gmail dot com
 Reported by:        webdevxp dot com at gmail dot com
 Summary:            Cannot use exit in preloading script
 Status:             Open
 Type:               Bug
 Package:            opcache
 PHP Version:        7.4.1
 Block user comment: N
 Private report:     N

 New Comment:

drtechno what are you talking about?

you can't do exit() in 'opcache.preload' script, no matter the environment, it's
that easy, period

on the other hand you shouldn't need too, the preload script can be easily written in a way
that everything is wrapped in if/switch statements and is executed or not dpending on the
environment


Previous Comments:
------------------------------------------------------------------------
[2019-12-20 12:03:07] drtechno at mail dot com

There is a couple of things to look at to debug code 70 (resources expended before exit) 

looking at a version's install:
pm = dynamic
pm.max_children = 5
pm.start_servers = 3
pm.min_spare_servers = 2
pm.max_spare_servers = 4
pm.max_requests = 200


pm.max_requests should be 500 to 800, not 200 


If you have a decent amount of memory, try pm = static. As the memory management of dynamic mode is
not that great, and I think its still a little too new and buggy.

even though it should be set this way, in the config file:

daemonize = no

Also, it doesn't hurt to pass the switch on the command argument. Some say they have to because
if they don't sometimes its starts in deamon mode. The argument to pass with the command:
--nodaemonize

Just remember, this module eats ram like crazy. Especially on non ascii (and greater than 7bit)
character sets.  

Its not a really good idea to run it as a daemon because its very power hungry nature, but if you do
I recommend a machine with no less than 16 core, with 256GB of ram.

------------------------------------------------------------------------
[2019-12-19 21:05:07] webdevxp dot com at gmail dot com

Description:
------------
When use exit to do clean exit (without argument or with 0 or with string), PHP-FPM
will exit with code 70.

Test script:
---------------
<?php
exit;


Expected result:
----------------
PHP-FPM continues normally.

Actual result:
--------------
PHP-FPM exits with code 70.


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



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


Thread (5 messages)

« previous php.bugs (#224445) next »