Started to get the following Exception following the server's Centos RPMs being updated:
PHP message: [2024-04-30 09:23:46] EXCEPTION: (Exception) Imbalanced AphrontWriteGuard: more beginUnguardedWrites() calls than endUnguardedWrites() calls. at [<phorge>/src/aphront/writeguard/AphrontWriteGuard.php:99] PHP message: arcanist(head=master, ref.master=ba42b63704b2, custom=4), phorge(head=master, ref.master=318d7a61feab) PHP message: #0 <#2> AphrontWriteGuard::dispose() called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:214] PHP message: #1 <#2> AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phorge>/webroot/index.php:35] PHP message: #2 phlog(Exception) called at [<phorge>/src/aphront/response/AphrontUnhandledExceptionResponse.php:32] PHP message: #3 AphrontUnhandledExceptionResponse::setException(Exception) called at [<phorge>/webroot/index.php:46]
This exception would be triggered by running arc diff or arc branches
The fix is:
--- a/src/applications/conduit/controller/PhabricatorConduitAPIController.php +++ b/src/applications/conduit/controller/PhabricatorConduitAPIController.php @@ -76,7 +76,7 @@ final class PhabricatorConduitAPIController if ($auth_error === null) { if ($allow_unguarded_writes) { - $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites(); + AphrontWriteGuard::beginUnguardedWrites(); } try { @@ -92,8 +92,9 @@ final class PhabricatorConduitAPIController $error_info = $call->getErrorDescription($error_code); } } + if ($allow_unguarded_writes) { - unset($unguarded); + AphrontWriteGuard::endUnguardedWrites(); } } else { list($error_code, $error_info) = $auth_error;