Page MenuHomePhabricator

Scripts may try to access PhabricatorStartup, but can not
Closed, ResolvedPublic

Description

We have a couple of tasks failing in the queue right now because of this error:

Daemon 35700 STDE [Wed, 27 May 2015 17:32:57 +0000] [2015-05-27 17:32:57] EXCEPTION: (PhutilProxyException) Error while executing Task ID 830591. {>} (PhutilMissingSymbolException) Failed to load class or interface 'PhabricatorStartup': the class or interface 'PhabricatorStartup' is not defined in the library map for any loaded phutil library. If this symbol was recently added or moved, your library map may be out of date. You can rebuild the map by running 'arc liberate'. For more information, see: http://www.phabricator.com/docs/phabricator/article/libphutil_Libraries_User_Guide.html at [<phutil>/src/__phutil_library_init__.php:25]
Daemon 35700 STDE [Wed, 27 May 2015 17:32:57 +0000] arcanist(head=master, ref.master=3ac80200e261), phabricator(head=master, ref.master=ebb7ca8cbdae), phutil(head=master, ref.master=c2cd90ee7aec)
Daemon 35700 STDE [Wed, 27 May 2015 17:32:57 +0000]   #0 <#2> __phutil_autoload(string) called at [<phutil>/src/__phutil_library_init__.php:25]
Daemon 35700 STDE [Wed, 27 May 2015 17:32:57 +0000]   #1 <#2> spl_autoload_call(string) called at [<phabricator>/src/applications/people/storage/PhabricatorUser.php:305]
Daemon 35700 STDE [Wed, 27 May 2015 17:32:57 +0000]   #2 <#2> PhabricatorUser::getCSRFToken() called at [<phabricator>/src/infrastructure/javelin/markup.php:91]
Daemon 35700 STDE [Wed, 27 May 2015 17:32:57 +0000]   #3 <#2> phabricator_form(PhabricatorUser, array, array) called at [<phabricator>/src/applications/slowvote/view/SlowvoteEmbedView.php:169]
Daemon 35700 STDE [Wed, 27 May 2015 17:32:57 +0000]   #4 <#2> SlowvoteEmbedView::render() called at [<phabricator>/src/view/AphrontView.php:175]
Daemon 35700 STDE [Wed, 27 May 2015 17:32:57 +0000]   #5 <#2> AphrontView::producePhutilSafeHTML() called at [<phutil>/src/markup/render.php:133]
Daemon 35700 STDE [Wed, 27 May 2015 17:32:57 +0000]   #6 <#2> phutil_escape_html(SlowvoteEmbedView)
Daemon 35700 STDE [Wed, 27 May 2015 17:32:57 +0000]   #7 <#2> array_map(string, array) called at [<phutil>/src/markup/engine/remarkup/PhutilRemarkupBlockStorage.php:56]
Daemon 35700 STDE [Wed, 27 May 2015 17:32:57 +0000]   #8 <#2> PhutilRemarkupBlockStorage::restore(PhutilSafeHTML, integer) called at [<phutil>/src/markup/engine/PhutilRemarkupEngine.php:299]
Daemon 35700 STDE [Wed, 27 May 2015 17:32:57 +0000]   #9 <#2> PhutilRemarkupEngine::restoreText(PhutilSafeHTML, integer) called at [<phutil>/src/markup/engine/PhutilRemarkupEngine.php:295]
Daemon 35700 STDE [Wed, 27 May 2015 17:32:57 +0000]   #10 <#2> PhutilRemarkupEngine::postprocessText(array) called at [<phabricator>/src/infrastructure/markup/PhabricatorMarkupEngine.php:138]
Daemon 35700 STDE [Wed, 27 May 2015 17:32:57 +0000]   #11 <#2> PhabricatorMarkupEngine::process() called at [<phabricator>/src/applications/feed/story/PhabricatorFeedStory.php:167]
Daemon 35700 STDE [Wed, 27 May 2015 17:32:57 +0000]   #12 <#2> PhabricatorFeedStory::loadAllFromRows(array, PhabricatorUser) called at [<phabricator>/src/applications/feed/query/PhabricatorFeedQuery.php:37]
Daemon 35700 STDE [Wed, 27 May 2015 17:32:57 +0000]   #13 <#2> PhabricatorFeedQuery::willFilterPage(array) called at [<phabricator>/src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php:237]
Daemon 35700 STDE [Wed, 27 May 2015 17:32:57 +0000]   #14 <#2> PhabricatorPolicyAwareQuery::execute() called at [<phabricator>/src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php:168]
Daemon 35700 STDE [Wed, 27 May 2015 17:32:57 +0000]   #15 <#2> PhabricatorPolicyAwareQuery::executeOne() called at [<phabricator>/src/applications/feed/worker/FeedPushWorker.php:12]
Daemon 35700 STDE [Wed, 27 May 2015 17:32:57 +0000]   #16 <#2> FeedPushWorker::loadFeedStory() called at [<phabricator>/src/applications/feed/worker/FeedPublisherWorker.php:6]
Daemon 35700 STDE [Wed, 27 May 2015 17:32:57 +0000]   #17 <#2> FeedPublisherWorker::doWork() called at [<phabricator>/src/infrastructure/daemon/workers/PhabricatorWorker.php:91]
Daemon 35700 STDE [Wed, 27 May 2015 17:32:57 +0000]   #18 <#2> PhabricatorWorker::executeTask() called at [<phabricator>/src/infrastructure/daemon/workers/storage/PhabricatorWorkerActiveTask.php:162]
Daemon 35700 STDE [Wed, 27 May 2015 17:32:57 +0000]   #19 <#2> PhabricatorWorkerActiveTask::executeTask() called at [<phabricator>/src/infrastructure/daemon/workers/PhabricatorTaskmasterDaemon.php:20]
Daemon 35700 STDE [Wed, 27 May 2015 17:32:57 +0000]   #20 PhabricatorTaskmasterDaemon::run() called at [<phutil>/src/daemon/PhutilDaemon.php:185]
Daemon 35700 STDE [Wed, 27 May 2015 17:32:57 +0000]   #21 PhutilDaemon::execute() called at [<phutil>/scripts/daemon/exec/exec_daemon.php:125]

Specifically, we may call PhabricatorStartup::blahblah() when, e.g., rendering feed stories.

However, PhabricatorStartup isn't loaded for scripts, and isn't autoloadable.

I don't see a clearcut way to easily fix this -- we can just load PhabricatorStartup explicitly in __init_script__.php, but that still won't make it available to the taskmasters.

Event Timeline

epriestley raised the priority of this task from to Wishlist.
epriestley updated the task description. (Show Details)
epriestley added a project: Infrastructure.
epriestley added a subscriber: epriestley.

A clean-ish but very non-general fix would be to load PhabricatorStartup explicitly before using it in code which might be hit on a non-web pathway. It looks like PhabricatorAccessControlTestCase.php already does this.

If we want to do this, moving the general parts (getRawInput(), getGlobal()) to be housed in PhabricatorEnv and having that pass through to PhabricatorStartup might make the most sense.