Bug #77312 [Com]: accel_replace_string_by_process_permanent: Assertion `0' failed

From: Date: Wed, 15 May 2019 08:38:51 +0000
Subject: Bug #77312 [Com]: accel_replace_string_by_process_permanent: Assertion `0' failed
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-220854@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77312&edit=1

 ID:                 77312
 Comment by:         swen dot zanon at geoglis dot de
 Reported by:        sjon at hortensius dot net
 Summary:            accel_replace_string_by_process_permanent: Assertion
                     `0' failed
 Status:             Closed
 Type:               Bug
 Package:            FPM related
 Operating System:   archlinux
 PHP Version:        7.3.1
 Assigned To:        bukka
 Block user comment: N
 Private report:     N

 New Comment:

I get this error message when I run the Zend bench-script Zend/bench.php under PHP 7.3.5

(gdb) run -f /usr/src/php-7.3.5/Zend/bench.php
Starting program: /usr/local/bin/php -f /usr/src/php-7.3.5/Zend/bench.php
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
simple             0.055
simplecall         0.026
simpleucall        0.028
simpleudcall       0.028
mandel             0.301
mandel2            0.403
ackermann(7)       0.179
ary(50000)         0.026
ary2(50000)        0.016
ary3(2000)         0.303
fibo(30)           0.492
hash1(50000)       0.089
hash2(500)         0.068
heapsort(20000)    0.142
matrix(20)         0.165
nestedloop(12)     0.159
sieve(30)          0.098
strcat(200000)     0.032
------------------------
Total              2.610
php: /usr/src/php-7.3.5/ext/opcache/ZendAccelerator.c:747:
accel_replace_string_by_process_permanent: Assertion `0' failed.

Program received signal SIGABRT, Aborted.

(gdb) backtrace
#0  0x00007ffff3b20f67 in raise () from /lib64/libc.so.6
#1  0x00007ffff3b2233a in abort () from /lib64/libc.so.6
#2  0x00007ffff3b19d66 in __assert_fail_base () from /lib64/libc.so.6
#3  0x00007ffff3b19e12 in __assert_fail () from /lib64/libc.so.6
#4  0x00007ffff1143c71 in accel_replace_string_by_process_permanent (str=0x7fffe2d022e0) at
/usr/src/php-7.3.5/ext/opcache/ZendAccelerator.c:747
#5  0x00007ffff114349f in accel_copy_permanent_strings (new_interned_string=0x7ffff1143c1d
<accel_replace_string_by_process_permanent>)
    at /usr/src/php-7.3.5/ext/opcache/ZendAccelerator.c:649
#6  0x00007ffff1143d3b in accel_use_permanent_interned_strings () at
/usr/src/php-7.3.5/ext/opcache/ZendAccelerator.c:775
#7  0x0000000000b39a29 in zend_interned_strings_switch_storage (request=0 '\000') at
/usr/src/php-7.3.5/Zend/zend_string.c:322
#8  0x0000000000a6f4ba in php_module_shutdown () at /usr/src/php-7.3.5/main/main.c:2473
#9  0x0000000000bd4177 in main (argc=3, argv=0x180e1c0) at
/usr/src/php-7.3.5/sapi/cli/php_cli.c:1404


So does this bug still exists in version 7.3.5 or is it a different one?


Previous Comments:
------------------------------------------------------------------------
[2019-04-22 17:31:06] bukka@php.net

I was able to recreate before the commit in 7.3.5-dev. I tested after the commit and it really seems
to be fixed now! Thanks Dmitry! Closing!

------------------------------------------------------------------------
[2019-04-19 07:31:31] sjon at hortensius dot net

thanks for your fix dmitry. However, this problem no longer occurs since (roughly) 7.3.2 so
it's hard for me to verify the correctness of your change.

------------------------------------------------------------------------
[2019-04-17 19:13:38] dmitry@php.net

This should fix the problem.

https://github.com/php/php-src/commit/bfadd9fdaf46dd9d9d447de38820122383af9c71


Please, verify and close the bug.

------------------------------------------------------------------------
[2019-02-03 19:47:14] bukka@php.net

I started playing with that and used zend_alter_ini_entry_ex. Just replacement will not work
correctly as discussed because it returns the original value. However if it was moved and done
before each request then it might work. Just need to find a clean way how to get the worker pool in
main request init - basically come up with some clean implementation. Will try again next week so
assigned it back to myself as it looks that Dmitry is busy anyway.

------------------------------------------------------------------------
[2019-01-27 16:49:47] bukka@php.net

I don't have much time to look what Opcache exactly does so re-assigning to Dmitry as he might
have a better idea what to do and what's the best approach.

I can just comment on the FPM behaviour and requirements. Basically the ini values are set in the
following cases:

* if php_value or php_admin_value is set in the FPM config, then the ini is modified on child init
(it means when the process is created and ready to handle requests - it means it can handle multiple
requests and should be the for the whole child life)
* if FCGI request sets PHP_VALUE or PHP_ADMIN_VALUE envs, then it is modified as well (from the code
it looks that this should actually stay set for all other requests in the child even if the
PHP_VALUE or PHP_ADMIN_VALUE are no longer set).

So it means that FPM needs a way to set an ini in the process that won't get changed. I'm
thinking that it might make sense to either save it as an original or maybe create another field for
the permanently modified ini values. Not really sure though.

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


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=77312


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


Thread (26 messages)

« previous php.bugs (#220854) next »