Page MenuHomePhabricator

ReplacementArray::replace() called with ResourceLoaderContext instead of string
Closed, DuplicatePublic

Description

This only rears its head when the Fast String Search extension is not present. When it is present, the extension swallows the error.

ErrorException from line 120 of includes/libs/ReplacementArray.php: Object of class ResourceLoaderContext could not be converted to string
#0 includes/libs/ReplacementArray.php(120): MWExceptionHandler::handleError(integer, string, string, integer)
#1 languages/Language.php(3176): ReplacementArray->replace(string)
#2 languages/classes/LanguageAr.php(47): Language->transformUsingPairFile(string, string)
#3 includes/WebRequest.php(318): LanguageAr->normalize(string)
#4 includes/WebRequest.php(345): WebRequest->normalizeUnicode(string)
#5 includes/WebRequest.php(363): WebRequest->getGPCVal(array, string, NULL)
#6 includes/resourceloader/ResourceLoaderContext.php(162): WebRequest->getVal(string)
#7 includes/resourceloader/ResourceLoader.php(1544): ResourceLoaderContext->getLanguage()
#8 includes/resourceloader/ResourceLoader.php(1485): ResourceLoader::createLoaderQuery(ResourceLoaderContext, array)

Event Timeline

ori claimed this task.
ori raised the priority of this task from to Needs Triage.
ori updated the task description. (Show Details)
ori added a project: MediaWiki-ResourceLoader.
ori subscribed.

Upgrading to hhvm 3.6.5+dfsg1-1+wm2 completely brought down translatewiki.net for 30 minutes due to hhvm segfaulting endlessly:

Host: translatewiki.net
ProcessID: 28092
ThreadID: 7f43be7ff700
ThreadPID: 28103
Name: unknown program
Type: Segmentation fault
Runtime: hhvm
Version: 1439579600_260361583
DebuggerCount: 0

Server: translatewiki.net
ThreadType: Web Request
Server_SERVER_NAME: translatewiki.net
URL: /w/i.php?group=out-mathjax-fontwarnings&language=tg-cyrl&taction=export&title=Special%3ATranslate

# 0  std::_Function_base::_Base_manager<void (*)(char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>::_M_manager(std::_Any_data&, std::_Any_data const&, std::_Manager_operation) at /usr/bin/hhvm:0
# 1  HPHP::WuManberReplacement::translate(HPHP::String) at /usr/bin/hhvm:0
# 2  HPHP::f_strtr(HPHP::String const&, HPHP::Variant const&, HPHP::Variant const&) at /usr/bin/hhvm:0
# 3  void HPHP::Native::callFunc<true, false>(HPHP::Func const*, void*, HPHP::TypedValue*, HPHP::TypedValue&) at /usr/bin/hhvm:0
# 4  void HPHP::dispatchImpl<false>() at /usr/bin/hhvm:0
# 5  HPHP::ExecutionContext::invokeFunc(HPHP::TypedValue*, HPHP::Func const*, HPHP::Variant const&, HPHP::ObjectData*, HPHP::Class*, HPHP::VarEnv*, HPHP::StringData*, HPHP::ExecutionContext::InvokeFlags) at /usr/bin/hhvm:0
# 6  HPHP::ExecutionContext::invokeUnit(HPHP::TypedValue*, HPHP::Unit const*) at /usr/bin/hhvm:0
# 7  HPHP::PackedArray::ToMixedCopyReserve(HPHP::ArrayData const*, unsigned long) at /usr/bin/hhvm:0
# 8  HPHP::include_impl_invoke(HPHP::String const&, bool, char const*) at /usr/bin/hhvm:0
# 9  HPHP::hphp_invoke(HPHP::ExecutionContext*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, HPHP::Array const&, HPHP::VRefParamValue const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, bool, bool, bool) at /usr/bin/hhvm:0
# 10 HPHP::HttpRequestHandler::executePHPRequest(HPHP::Transport*, HPHP::RequestURI&, HPHP::SourceRootInfo&, bool) at /usr/bin/hhvm:0
# 11 HPHP::HttpRequestHandler::handleRequest(HPHP::Transport*) at /usr/bin/hhvm:0
# 12 HPHP::ServerWorker<std::shared_ptr<HPHP::FastCGIJob>, HPHP::FastCGITransportTraits>::doJobImpl(std::shared_ptr<HPHP::FastCGIJob>, bool) at /usr/bin/hhvm:0
# 13 HPHP::ServerWorker<std::shared_ptr<HPHP::FastCGIJob>, HPHP::FastCGITransportTraits>::doJob(std::shared_ptr<HPHP::FastCGIJob>) at /usr/bin/hhvm:0
# 14 HPHP::JobQueueWorker<std::shared_ptr<HPHP::FastCGIJob>, HPHP::Server*, true, false, HPHP::JobQueueDropVMStack>::start() at /usr/bin/hhvm:0
# 15 HPHP::AsyncFuncImpl::ThreadFunc(void*) at /usr/bin/hhvm:0
# 16 HPHP::start_routine_wrapper(void*) at /usr/bin/hhvm:0
# 17 start_thread at /build/buildd/eglibc-2.19/nptl/pthread_create.c:312
# 18 clone at /build/buildd/eglibc-2.19/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:113

PHP Stacktrace:

#0  ReplacementArray->replace(ku) called at [/srv/mediawiki/tags/2015-08-15_11:50:44/languages/Language.php:3176]
#1  Language->transformUsingPairFile(normalize-ar.ser, ku) called at [/srv/mediawiki/tags/2015-08-15_11:50:44/languages/Language.php:3147]
#2  Language->normalize(ku) called at [/srv/mediawiki/tags/2015-08-15_11:50:44/includes/WebRequest.php:318]
#3  WebRequest->normalizeUnicode(ku) called at [/srv/mediawiki/tags/2015-08-15_11:50:44/includes/WebRequest.php:345]
#4  WebRequest->getGPCVal(Array, lang, ) called at [/srv/mediawiki/tags/2015-08-15_11:50:44/includes/WebRequest.php:363]
#5  WebRequest->getVal(lang) called at [/srv/mediawiki/tags/2015-08-15_11:50:44/includes/resourceloader/ResourceLoaderContext.php:162]
#6  ResourceLoaderContext->getLanguage() called at [/srv/mediawiki/tags/2015-08-15_11:50:44/includes/resourceloader/ResourceLoader.php:1544]
#7  ResourceLoader::createLoaderQuery(Object of class ResourceLoaderContext could not be converted to string, Array) called at [/srv/mediawiki/tags/2015-08-15_11:50:44/includes/resourceloader/ResourceLoader.php:1485]
#8  ResourceLoader->createLoaderURL(local, Object of class ResourceLoaderContext could not be converted to string, Array) called at [/srv/mediawiki/tags/2015-08-15_11:50:44/includes/OutputPage.php:2908]
#9  OutputPage->makeResourceLoaderLink(Array, styles) called at [/srv/mediawiki/tags/2015-08-15_11:50:44/includes/OutputPage.php:3078]
#10 OutputPage->getScriptsForBottomQueue() called at [/srv/mediawiki/tags/2015-08-15_11:50:44/includes/OutputPage.php:3149]
#11 OutputPage->getBottomScripts() called at [/srv/mediawiki/tags/2015-08-15_11:50:44/includes/skins/Skin.php:620]
#12 Skin->bottomScripts() called at [/srv/mediawiki/tags/2015-08-15_11:50:44/includes/skins/SkinTemplate.php:417]
#13 SkinTemplate->prepareQuickTemplate() called at [/srv/mediawiki/tags/2015-08-15_11:50:44/includes/skins/SkinTemplate.php:230]

I have no idea why it did not load the fss extension which was specified in the configuration. However upgrading to upstream hhvm 3.8.1 [1] made the problem go away, which leads me to believe hhvm 3.6.5+dfsg1-1+wm2 is buggy (or less tolerant to bad input).

[1] It was the only way I was able to get translatewiki.net back up.

Krinkle triaged this task as High priority.Aug 19 2015, 3:52 PM
Krinkle set Security to None.
Krinkle moved this task from Inbox to Accepted Enhancement on the MediaWiki-ResourceLoader board.
Krinkle subscribed.

Upgrading to hhvm 3.6.5+dfsg1-1+wm2 completely brought down translatewiki.net for 30 minutes due to hhvm segfaulting endlessly

That was T109540, a separate issue. hhvm 3.6.5+dfsg1-1+wm3 should fix that problem.