Bug #80904 [NEW]: non-atomic behaviour when changing symlinked doc-root

From: Date: Wed, 24 Mar 2021 17:23:53 +0000
Subject: Bug #80904 [NEW]: non-atomic behaviour when changing symlinked doc-root
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-232980@lists.php.net to get a copy of this message
From: maggus dot staab+php at googlemail dot com Operating system: ubuntu linux 20 lts PHP version: 7.4.16 Package: *General Issues Bug Type: Bug Bug description:non-atomic behaviour when changing symlinked doc-root Description: ------------ we are experiencing errors when deploying new code/updates onto our servers. these are rare errors which happen after the deployment tool swaps the doc-root symlink. we are using a popular deployment tool from https://deployer.org/ I guess what triggers our error can be described as the following - http request are comig in - apache server receives the request, resolves the doc-root symlink and starts processing the request with version A of our codebase - a deployment happens which swaps the symlink of the doc-root to version A+1 - the request, which was started before, realizes the symlink switched and while serving a request now picks up changes from app version A+1 this leads to errors like "Cannot redeclare function", "class already defined" and sometimes we even see errors like out-of-memory. from our error reporting its pretty clear that requests mix classes from codebase in version A and version A+1: App Path: /www/myapp/releases/234/app/www-phone Request-Id: 118c703 Exception: 'ErrorException' with message 'Cannot redeclare renderTrackableOrderBySelect() (previously declared in /www/myapp/releases/234/vendor/plugins/clxMobileNetPortable/lib/portable/helpers/ViewHelper.php:442)' (1) the stacktrace from this error contains the path to version A+1, while the initial App-Path which is set very early in the bootsrap as a php constant, was defined as Version A. I feel/guess the problem we experience is the one which rasmus created this apache module for: https://github.com/etsy/mod_realdoc in our setup we are running php in mpm event mode, which the mentioned apache module does not work with (per README notes). the underlying issue seems to be discussed here: https://github.com/etsy/mod_realdoc/issues/4 I hope for some inspiration/pointers on how this problem could be tackled or which tools/mods should/can be used to circumvent the problem reported. feel free to ask further questions in case I missed some important information Test script: --------------- the errors happen only from time to time and cannot be reproduced easily. I guess I can not really provide a test-script. Expected result: ---------------- a php request should be atomic and should not change the doc-root while the request is running -- Edit bug report at https://bugs.php.net/bug.php?id=80904&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=80904&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=80904&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=80904&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=80904&r=needscript Try newer version: https://bugs.php.net/fix.php?id=80904&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=80904&r=support Expected behavior: https://bugs.php.net/fix.php?id=80904&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=80904&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=80904&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=80904&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=80904&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=80904&r=dst IIS Stability: https://bugs.php.net/fix.php?id=80904&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=80904&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=80904&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=80904&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=80904&r=mysqlcfg

« previous php.bugs (#232980) next »