[php-src] Issue #7915: php_opcache crash - memory access violation
| From: | cmb69 | Date: | Sun, 09 Jan 2022 13:35:29 +0000 |
| Subject: | [php-src] Issue #7915: php_opcache crash - memory access violation | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-238900@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/7915
Comment Author: cmb69
Thanks for the detailed reply!
> I'm not sure of the exact syntax for that
If you're starting the PHP scripts from batch files, you could pass the cache_id as command
line option:
````
php -d opcache.cache_id=%ID% …
`````
The
%ID% can be hardcoded there. Or you could use some tool like uuidgen to generate a
UUID on the fly. Or maybe some powershell script.
> My intention was to have one large cache for efficiency.
Yes, that's reasonable. However, *if* the actual issue is really caused by different memory
layout due to ASLR[1], that just won't work. The only way a single OPcache instance could
reliably work for the CLI would be to have a single long-running CLI process (basically a service)
which actually executes the different tasks; to be able to run multiple tasks in parallel, you would
need to use an extension which allows to do so in a single process (e.g.
[parallel](http://pecl.php.net/parallel)).
[1] I'm not sure whether this is actually the reason, but we faced the same issue when the PHP
test runner was improved to run tests in parallel, and the solution we came up with was actually the
opcache.cache_id which solved the issue nicely.