Page MenuHomePhabricator

Crash when pushing content to Git repository
Closed, ResolvedPublic

Description

Getting the following crash when pushing content to a Git repository:

>>> UNRECOVERABLE FATAL ERROR <<<

Call to a member function validateCSRFToken() on a non-object

/srv/phabricator/phabricator/src/aphront/AphrontRequest.php:209


┻━┻ ︵ ¯\_(ツ)_/¯ ︵ ┻━┻

Adding a if ($this->getUser() === null) { return true; } check before this line allows the Git push to succeed correctly.

Event Timeline

waynea assigned this task to epriestley.
waynea raised the priority of this task from to Needs Triage.
waynea updated the task description. (Show Details)
waynea added a project: Diffusion.
waynea added subscribers: waynea, Unknown Object (User), hach-que.

This is caused by this change: https://secure.phabricator.com/D7468?vs=16834&id=16838&whitespace=ignore-all#toc, which ironically is the difference between the accepted revision and the code that was landed.

The call to writeStatusMessage on the repository causes a MySQL UPDATE to occur, which in turn means Phabricator calls checkWrite. Here's the full stack trace right before the crash point:

#0  AphrontRequest->validateCSRF()
#1  call_user_func(Array ([0] => AphrontRequest Object ([] => phabricator.local,[] => /diffusion/TEST/info/refs,[] => Array ([__path__] => /diffusion/TEST/info/refs,[service] => git-receive-pack),[] => ,[] => AphrontDefaultApplicationConfiguration Object ([] => AphrontRequest Object ( *RECURSION*,[] => phabricator.local,[] => /diffusion/TEST/info/refs,[] => )),[1] => validateCSRF)) called at [/home/james/Projects/Phabricator/libphutil/src/aphront/writeguard/AphrontWriteGuard.php:177]
#2  AphrontWriteGuard::willWrite() called at [/home/james/Projects/Phabricator/libphutil/src/aphront/storage/connection/mysql/AphrontMySQLDatabaseConnectionBase.php:263]
#3  AphrontMySQLDatabaseConnectionBase->checkWrite(INSERT INTO `repository_statusmessage`
          (repositoryID, statusType, statusCode, parameters, epoch)
          VALUES (1, 'needs-update', 'okay', '[]', 1383549929)
          ON DUPLICATE KEY UPDATE
            statusCode = VALUES(statusCode),
            parameters = VALUES(parameters),
            epoch = VALUES(epoch)) called at [/home/james/Projects/Phabricator/libphutil/src/aphront/storage/connection/mysql/AphrontMySQLDatabaseConnectionBase.php:160]
#4  AphrontMySQLDatabaseConnectionBase->executeRawQuery(INSERT INTO `repository_statusmessage`
          (repositoryID, statusType, statusCode, parameters, epoch)
          VALUES (1, 'needs-update', 'okay', '[]', 1383549929)
          ON DUPLICATE KEY UPDATE
            statusCode = VALUES(statusCode),
            parameters = VALUES(parameters),
            epoch = VALUES(epoch)) called at [/home/james/Projects/Phabricator/libphutil/src/xsprintf/queryfx.php:9]
#5  queryfx(AphrontMySQLiDatabaseConnection Object ([] => Array ([user] => root,[pass] => PhutilOpaqueEnvelope Object ([] => ),[host] => localhost,[port] => ,[database] => phabricator_repository,[retries] => 3),[] => mysqli Object ([affected_rows] => ,[client_info] => ,[client_version] => ,[connect_errno] => ,[connect_error] => ,[errno] => ,[error] => ,[error_list] => ,[field_count] => ,[host_info] => ,[info] => ,[insert_id] => ,[server_info] => ,[server_version] => ,[stat] => ,[sqlstate] => ,[protocol_version] => ,[thread_id] => ,[warning_count] => ),[] => Array (),[] => ,[] => ,[] => ), INSERT INTO %T
          (repositoryID, statusType, statusCode, parameters, epoch)
          VALUES (%d, %s, %s, %s, %d)
          ON DUPLICATE KEY UPDATE
            statusCode = VALUES(statusCode),
            parameters = VALUES(parameters),
            epoch = VALUES(epoch), repository_statusmessage, 1, needs-update, okay, [], 1383549929) called at [/home/james/Projects/Phabricator/phabricator/src/applications/repository/storage/PhabricatorRepository.php:881]
#6  PhabricatorRepository->writeStatusMessage(needs-update, okay) called at [/home/james/Projects/Phabricator/phabricator/src/applications/diffusion/controller/DiffusionController.php:197]
#7  DiffusionController->processVCSRequest(TEST) called at [/home/james/Projects/Phabricator/phabricator/src/applications/diffusion/controller/DiffusionController.php:58]
#8  DiffusionController->willBeginExecution() called at [/home/james/Projects/Phabricator/phabricator/webroot/index.php:72]
<br />
<b>Fatal error</b>:  Call to a member function validateCSRFToken() on a non-object in <b>/home/james/Projects/Phabricator/phabricator/src/aphront/AphrontRequest.php</b> on line <b>211</b><br />
>>> UNRECOVERABLE FATAL ERROR <<<

Call to a member function validateCSRFToken() on a non-object

/home/james/Projects/Phabricator/phabricator/src/aphront/AphrontRequest.php:211


┻━┻ ︵ ¯\_(ツ)_/¯ ︵ ┻━┻

Yeah, my last change there was pretty garbage -- it omitted a break;, too. Thanks for fixing this!