Page MenuHomePhabricator

Unguarded write error on every page
Closed, ResolvedPublic

Description

Post updating this morning I get this on every page:

Screen Shot 2015-05-14 at 9.43.46 AM.png (1×2 px, 303 KB)

"Unguarded write! There must be an active AphrontWriteGuard to perform writes."

Event Timeline

btrahan raised the priority of this task from to Needs Triage.
btrahan updated the task description. (Show Details)
btrahan added a project: Aphront.
btrahan added subscribers: btrahan, epriestley.

I can't immediately reproduce this -- do you have a trace in the Apache/php-fpm error log?

Error logs are quiet. I put in a phlog(debug_backtrace()) and played with print_r but its hard to get a lot of text out of phlog?

Basically got useless stuff like the below

[Thu May 14 09:50:16 2015] [error] [client 127.0.0.1] [2015-05-14 09:50:16] PHLOG: 'Array\n(\n    [0] => Array\n        (\n            [file] => /Users/btrahan/Dropbox/code/libphutil/src/aphront/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php\n            [line] => 260\n            [function] => willWrite\n            [class] => AphrontWriteGuard\n            [type] => ::\n            [args] => Array\n                (\n                )\n\n        )\n\n    [1] => Array\n        (\n            [file] => /Users/btrahan/Dropbox/code/libphutil/src/aphront/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php\n            [line] => 157\n            [function] => checkWrite\n            [class] => AphrontBaseMySQLDatabaseConnection\n            [object] => AphrontMySQLiDatabaseConnection Object\n                (\n                    [configuration:AphrontBaseMySQLDatabaseConnection:private] => Array\n                        (\n                            [user] => root\n                            [pass] => PhutilOpaqueEnvelope Object\n                                (\n                           ...' at [/Users/btrahan/Dropbox/code/libphutil/src/aphront/writeguard/AphrontWriteGuard.php:171]
[Thu May 14 09:50:38 2015] [error] [client 127.0.0.1] [2015-05-14 09:50:38] PHLOG: 'Array\n(\n    [0] => Array\n        (\n            [file] => /Users/btrahan/Dropbox/code/libphutil/src/aphront/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php\n            [line] => 260\n            [function] => willWrite\n            [class] => AphrontWriteGuard\n            [type] => ::\n            [args] => Array\n                (\n                )\n\n        )\n\n    [1] => Array\n        (\n            [file] => /Users/btrahan/Dropbox/code/libphutil/src/aphront/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php\n            [line] => 157\n            [function] => checkWrite\n            [class] => AphrontBaseMySQLDatabaseConnection\n            [object] => AphrontMySQLiDatabaseConnection Object\n                (\n                    [configuration:AphrontBaseMySQLDatabaseConnection:private] => Array\n                        (\n                            [user] => root\n                            [pass] => PhutilOpaqueEnvelope Object\n                                (\n                           ...' at [/Users/btrahan/Dropbox/code/libphutil/src/aphront/writeguard/AphrontWriteGuard.php:171]
[Thu May 14 09:50:39 2015] [error] [client 127.0.0.1] [2015-05-14 09:50:39] PHLOG: 'Array\n(\n    [0] => Array\n        (\n            [file] => /Users/btrahan/Dropbox/code/libphutil/src/aphront/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php\n            [line] => 260\n            [function] => willWrite\n            [class] => AphrontWriteGuard\n            [type] => ::\n            [args] => Array\n                (\n                )\n\n        )\n\n    [1] => Array\n        (\n            [file] => /Users/btrahan/Dropbox/code/libphutil/src/aphront/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php\n            [line] => 157\n            [function] => checkWrite\n            [class] => AphrontBaseMySQLDatabaseConnection\n            [object] => AphrontMySQLiDatabaseConnection Object\n                (\n                    [configuration:AphrontBaseMySQLDatabaseConnection:private] => Array\n                        (\n                            [user] => root\n                            [pass] => PhutilOpaqueEnvelope Object\n                                (\n                           ...' at [/Users/btrahan/Dropbox/code/libphutil/src/aphront/writeguard/AphrontWriteGuard.php:171]

I have to walk the dog so I will be afk 20ish minutes but this will be what I am working on when I get back.

Just doing phlog($ex) might be useful (or phlog(new Exception()) if you aren't actually catching one).

Offhand, my only guess is that it's the new user profile image cache stuff somehow running outside of the context of a write guard, but I'm not sure how that's possible.

OoOoO, great tip.

Thu May 14 09:55:54 2015] [error] [client 127.0.0.1] [2015-05-14 09:55:54] EXCEPTION: (Exception)  at [<phutil>/src/aphront/writeguard/AphrontWriteGuard.php:173]
[Thu May 14 09:55:54 2015] [error] [client 127.0.0.1] arcanist(head=master, ref.master=383633e63fd7), phabricator(head=master, ref.master=f233672feb52), phutil(head=master, ref.master=f06c0b71f369)
[Thu May 14 09:55:54 2015] [error] [client 127.0.0.1]   #0 AphrontWriteGuard::willWrite() called at [<phutil>/src/aphront/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php:260]
[Thu May 14 09:55:54 2015] [error] [client 127.0.0.1]   #1 AphrontBaseMySQLDatabaseConnection::checkWrite(string) called at [<phutil>/src/aphront/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php:157]
[Thu May 14 09:55:54 2015] [error] [client 127.0.0.1]   #2 AphrontBaseMySQLDatabaseConnection::executeRawQuery(string) called at [<phutil>/src/xsprintf/queryfx.php:6]
[Thu May 14 09:55:54 2015] [error] [client 127.0.0.1]   #3 queryfx(AphrontMySQLiDatabaseConnection, string, string, string, string) called at [<phabricator>/src/applications/people/storage/PhabricatorUser.php:771]
[Thu May 14 09:55:54 2015] [error] [client 127.0.0.1]   #4 PhabricatorUser::writeProfileImageCache(string) called at [<phabricator>/src/applications/people/query/PhabricatorPeopleQuery.php:197]
[Thu May 14 09:55:54 2015] [error] [client 127.0.0.1]   #5 PhabricatorPeopleQuery::didFilterPage(array) called at [<phabricator>/src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php:261]
[Thu May 14 09:55:54 2015] [error] [client 127.0.0.1]   #6 PhabricatorPolicyAwareQuery::execute() called at [<phabricator>/src/applications/phid/type/PhabricatorPHIDType.php:102]
[Thu May 14 09:55:54 2015] [error] [client 127.0.0.1]   #7 PhabricatorPHIDType::loadObjects(PhabricatorObjectQuery, array) called at [<phabricator>/src/applications/phid/query/PhabricatorObjectQuery.php:141]
[Thu May 14 09:55:54 2015] [error] [client 127.0.0.1]   #8 PhabricatorObjectQuery::loadObjectsByPHID(array, array) called at [<phabricator>/src/applications/phid/query/PhabricatorObjectQuery.php:63]
[Thu May 14 09:55:54 2015] [error] [client 127.0.0.1]   #9 PhabricatorObjectQuery::loadPage() called at [<phabricator>/src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php:228]
[Thu May 14 09:55:54 2015] [error] [client 127.0.0.1]   #10 PhabricatorPolicyAwareQuery::execute() called at [<phabricator>/src/applications/phid/query/PhabricatorHandleQuery.php:25]
[Thu May 14 09:55:54 2015] [error] [client 127.0.0.1]   #11 PhabricatorHandleQuery::loadPage() called at [<phabricator>/src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php:228]
[Thu May 14 09:55:54 2015] [error] [client 127.0.0.1]   #12 PhabricatorPolicyAwareQuery::execute() called at [<phabricator>/src/applications/policy/config/PolicyLockOptionType.php:48]
[Thu May 14 09:55:54 2015] [error] [client 127.0.0.1]   #13 PolicyLockOptionType::validateOption(PhabricatorConfigOption, array) called at [<phabricator>/src/applications/config/option/PhabricatorApplicationConfigOptions.php:24]
[Thu May 14 09:55:54 2015] [error] [client 127.0.0.1]   #14 PhabricatorApplicationConfigOptions::validateOption(PhabricatorConfigOption, array) called at [<phabricator>/src/applications/config/check/PhabricatorInvalidConfigSetupCheck.php:17]
[Thu May 14 09:55:54 2015] [error] [client 127.0.0.1]   #15 PhabricatorInvalidConfigSetupCheck::executeChecks() called at [<phabricator>/src/applications/config/check/PhabricatorSetupCheck.php:45]
[Thu May 14 09:55:54 2015] [error] [client 127.0.0.1]   #16 PhabricatorSetupCheck::runSetupChecks() called at [<phabricator>/src/applications/config/check/PhabricatorSetupCheck.php:129]
[Thu May 14 09:55:54 2015] [error] [client 127.0.0.1]   #17 PhabricatorSetupCheck::runAllChecks() called at [<phabricator>/src/applications/config/check/PhabricatorSetupCheck.php:91]
[Thu May 14 09:55:54 2015] [error] [client 127.0.0.1]   #18 PhabricatorSetupCheck::willProcessRequest() called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:89]
[Thu May 14 09:55:54 2015] [error] [client 127.0.0.1]   #19 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phabricator>/webroot/index.php:19]

(really going on that walk now)