Description
Follow-up to the OpCache binary-file API (#111, merged). Explicitly deferred in docs/opcache-binary.md.
Today the patch→refresh loop is proven under opcache.file_cache_only=1; when opcache also uses shared memory, a resident script is only re-read after invalidation. The next step is to publish a patched image directly into the running accelerator's shared memory (ZCSG) so all workers pick it up without a file-cache round-trip.
Scope (research + implementation): bind the non-public opcache SHM entry points (zend_file_cache_script_load / zend_accel_hash_update / ZCSG(hash)), or an equivalent path, to install a patched zend_persistent_script into SHM safely across workers. This depends on opcache.so symbol visibility and careful locking; likely large and fragile across builds. Foundation for #121 (hot-swap wiring).
Activity
lisachenko commentedon Aug 19, 2026
Closing as not planned — the feasibility spike (PR #265, full report in
docs/research/zcsg-spike.md) concludes direct ZCSG publication is infeasible against stock opcache:opcache.soexports only 6 default-visibility dynamic symbols; every write-path entry point (zend_shared_alloc,zend_accel_hash_update,zend_shared_alloc_lock,zend_accel_shared_protect,zend_file_cache_script_load, the ZCSG/accel_shared_globalspointer, the lock fd) is hidden-visibility and empirically un-bindable via FFI. No ini flag or z-engine change exports them.opcache.protect_memory=1(the default-safe posture). No lock, no safe interned-string mutation, no crash atomicity — none mitigable.ZCSG(hash)live via the one exportedsmm_shared_globals), but that is not the hard part.The use case is already covered:
BinaryCacheFile::refresh()drives opcache's ownzend_file_cache_script_load()— the entire locked install — on a compile miss (proven bySharedMemoryRefreshTest, #125). Since FPM workers share one SHM segment, one faulting request republishes for all. Direct writes would only add push-without-a-warm-up-request, not worth racing every worker outside opcache's lock. The only sound route to that extra capability is a companion opcache/extension patch re-exporting the locked install path — a native artifact, which contradicts z-engine's stock-PHP premise, so out of scope for this library.The epic's possible/impossible matrix is updated accordingly: ZCSG direct writes = infeasible vs stock opcache;
refresh()is the SHM publication mechanism.Generated by Claude Code