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

From: Date: Wed, 24 Mar 2021 17:28:39 +0000
Subject: Bug #80904 [Opn]: non-atomic behaviour when changing symlinked doc-root
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-232981@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80904&edit=1 ID: 80904 User updated by: maggus dot staab+php at googlemail dot com Reported by: maggus dot staab+php at googlemail dot com Summary: non-atomic behaviour when changing symlinked doc-root Status: Open Type: Bug Package: *General Issues Operating System: ubuntu linux 20 lts PHP Version: 7.4.16 Block user comment: N Private report: N New Comment: it seems I cannot edit the initial bug description, therefore here a small correction. our error reporting shows App Path: /www/myapp/releases/233/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) see different app revision in 'App Path' vs. 'Exception Stack Trace'. in the initial report I copy & paste'd the wrong numbers. Previous Comments: ------------------------------------------------------------------------ [2021-03-24 17:23:52] maggus dot staab+php at googlemail dot com 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 this bug report at https://bugs.php.net/bug.php?id=80904&edit=1

« previous php.bugs (#232981) next »