Page MenuHomePhabricator

Infinite loop in MobileContext->toggleView('mobile')
Closed, ResolvedPublic

Description

39,289 line stacktrace recorded in fatal.log on fluorine of the form ABCDEF(GHIJ)+. Frames 6-9 are repeated until PHP runs out of memory.

[28-Feb-2014 09:40:48] Fatal error: Allowed memory size of 230686720 bytes exhau
sted (tried to allocate 523800 bytes) at /usr/local/apache/common-local/php-1.23
wmf16/includes/profiler/ProfilerSimple.php on line 38
Server: mw1186
Method: GET
URL: http://test2.wikipedia.org/w/index.php?title=Template:Orphan&action=edit&mo
bileaction=toggle_view_mobile
Cookie:
Backtrace:
#0 /usr/local/apache/common-local/php-1.23wmf16/includes/profiler/Profiler.php(3
8): ProfilerSimple->profileIn('hook: GetLocalU...')
#1 /usr/local/apache/common-local/php-1.23wmf16/includes/Hooks.php(137): wfProfi
leIn('hook: GetLocalU...')
#2 /usr/local/apache/common-local/php-1.23wmf16/includes/GlobalFunctions.php(400
8): Hooks::run('GetLocalURL::Ar...', Array, NULL)
#3 /usr/local/apache/common-local/php-1.23wmf16/includes/Title.php(1568): wfRunH
ooks('GetLocalURL::Ar...', Array)
#4 /usr/local/apache/common-local/php-1.23wmf16/includes/Title.php(1514): Title-

getLocalURL('')

#5 /usr/local/apache/common-local/php-1.23wmf16/extensions/MobileFrontend/includes/MobileContext.php(800): Title->getFullURL()
#6 /usr/local/apache/common-local/php-1.23wmf16/extensions/MobileFrontend/includes/MobileContext.php(849): MobileContext->toggleView('mobile')
#7 /usr/local/apache/common-local/php-1.23wmf16/extensions/MobileFrontend/includes/MobileContext.php(278): MobileContext->checkToggleView()
#8 /usr/local/apache/common-local/php-1.23wmf16/extensions/MobileFrontend/includes/MobileContext.php(615): MobileContext->shouldDisplayMobileView()
#9 /usr/local/apache/common-local/php-1.23wmf16/extensions/MobileFrontend/includes/MobileContext.php(817): MobileContext->getMobileUrl('test2.wikiped...')
#10 /usr/local/apache/common-local/php-1.23wmf16/extensions/MobileFrontend/includes/MobileContext.php(849): MobileContext->toggleView('mobile')
#11 /usr/local/apache/common-local/php-1.23wmf16/extensions/MobileFrontend/includes/MobileContext.php(278): MobileContext->checkToggleView()
#12 /usr/local/apache/common-local/php-1.23wmf16/extensions/MobileFrontend/includes/MobileContext.php(615): MobileContext->shouldDisplayMobileView()
#13 /usr/local/apache/common-local/php-1.23wmf16/extensions/MobileFrontend/includes/MobileContext.php(817): MobileContext->getMobileUrl('
test2.wikiped...')
[...snip...]
#39289 /usr/local/apache/common-local/php-1.23wmf16/extensions/MobileFrontend/in
cludes/MobileContext.php(817): MobileContext->getMobileUrl('//test2.wikiped...')


Version: unspecified
Severity: blocker

Details

Reference
bz62078

Event Timeline

bzimport raised the priority of this task from to Unbreak Now!.Nov 22 2014, 3:05 AM
bzimport set Reference to bz62078.
bzimport added a subscriber: Unknown Object (MLST).

bingle-admin wrote:

Prioritization and scheduling of this bug is tracked on Mingle card https://wikimedia.mingle.thoughtworks.com/projects/mobile/cards/1740

Huh - http://test2.wikipedia.org/w/index.php?title=Template:Orphan&action=edit&mo
bileaction=toggle_view_mobile is not a URL that should ever get exposed, and from poking around I can't figure out where this would have come from. URLs with 'mobileaction=toggle_view_mobile' should only ever appear on wikis that do not have a mobile-specific subdomain configured. I wonder if someone created this manually. Regardless, the infinite loop should not be happening and I suspect it's happening because MobileFrontend does not expect to see mobileaction=toggle_view_mobile on a wiki with a mobile-specific subdomain. I am digging into it now.

I am not seeing the behavior on wikipedias. I believe this was introduced by https://gerrit.wikimedia.org/r/#/c/114392/1

The scope of this problem theoretically ought to be small, since URLs that trigger this behavior are not being exposed anywhere (at least that I could find). Bryan, do you have any way of confirming that the scope here is relatively small?

It does not seem to be widespread yet, but the 1.23wmf16 branch is only on the group 0 wikis at the moment.

fluorine:~
bd808$ fgrep toggle_view_mobile /a/mw-log/*.log
/a/mw-log/api.log:2014-02-28 17:08:28 mw1120 enwiki: API POST 10.64.32.73 10.64.32.73 T=52ms format=json action=parse text=%3Csyntaxhighlight%20lang%3D%22javascript%22%3E%0A$(%27a%5Bhref$%3D%22toggle_view_mobile%22%5D%27).click(function()%7B%0A%20%20%20%20%20%20%20document.cookie%20%3D%20%27stopMobileRedirect%3Dfalse;%20domain%3D.wikipedia.org;%27%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%2B%20%27path%3D/;%20expires%3DThu,%2001-Jan-1970%2000:00:00%20GMT;%27;%0A%7D);%0A%3C/syntaxhigh[...] disablepp=true
/a/mw-log/api.log:2014-02-28 17:08:28 mw1129 enwiki: API POST 10.64.32.73 10.64.32.73 T=79ms format=json action=parse text=%3Csyntaxhighlight%20lang%3D%22javascript%22%3E%0A$(%27a%5Bhref$%3D%22toggle_view_mobile%22%5D%27).click(function()%7B%0A%20%20%20%20%20%20%20$.cookie(%27stopMobileRedirect%27,%27false%27,%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%20domain:%20%27.wikipedia.org%27,%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20path:%20%27/%27,%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20expires:%20%27Thu,%2001-Jan-1970%2000:[...] disablepp=true
/a/mw-log/fatal.log:URL: http://test2.wikipedia.org/w/index.php?title=Template:Orphan&action=edit&mobileaction=toggle_view_mobile
/a/mw-log/fatal.log:URL: http://test2.wikipedia.org/w/index.php?title=Bahrain&action=edit&mobileaction=toggle_view_mobile
/a/mw-log/fatal.log:URL: http://test2.wikipedia.org/w/index.php?title=Kyrgyzstan&action=edit&mobileaction=toggle_view_mobile
/a/mw-log/fatal.log:URL: http://test2.wikipedia.org/w/index.php?title=Talk:Nepal&action=edit&redlink=1&mobileaction=toggle_view_mobile
/a/mw-log/fatal.log:URL: http://test2.wikipedia.org/w/index.php?title=Rule&action=edit&redlink=1&mobileaction=toggle_view_mobile
/a/mw-log/fatal.log:URL: http://test2.wikipedia.org/w/index.php?title=Bluebook&action=edit&redlink=1&mobileaction=toggle_view_mobile
/a/mw-log/fatal.log:URL: http://test2.wikipedia.org/w/index.php?title=User:RobLa-WMF&mobileaction=toggle_view_mobile
/a/mw-log/fatal.log:URL: http://test2.wikipedia.org/w/index.php?title=Justice&action=edit&redlink=1&mobileaction=toggle_view_mobile
/a/mw-log/fatal.log:URL: http://test2.wikipedia.org/w/index.php?title=Template:Orphan&action=edit&mobileaction=toggle_view_mobile
/a/mw-log/fatal.log:URL: http://www.mediawiki.org/w/index.php?title=Template:Orphan&action=edit&mobileaction=toggle_view_mobile
/a/mw-log/test2wiki.log:Start request GET /w/index.php?title=Special:UserLogin&type=signup&returnto=Chris+Montez&returntoquery=action%3Dedit%26redlink%3D1%26mobileaction%3Dtoggle_view_mobile
/a/mw-log/test2wiki.log:20140228084840 0.123 /w/index.php?title=Special:UserLogin&type=signup&returnto=Chris Montez&returntoquery=action=edit&redlink=1&mobileaction=toggle_view_mobile (proxied via 10.64.0.102 forwarded for 137.110.244.134, 10.128.0.116, 10.128.0.109) anon
/a/mw-log/test2wiki.log:Start request GET /w/index.php?title=Template:Orphan&action=edit&mobileaction=toggle_view_mobile
/a/mw-log/test2wiki.log:Start request GET /w/index.php?title=Special:UserLogin&returnto=Maggie+May+%28traditional+song%29&returntoquery=action%3Dedit%26mobileaction%3Dtoggle_view_mobile&type=signup
/a/mw-log/test2wiki.log:20140228110135 0.154 /w/index.php?title=Special:UserLogin&returnto=Maggie May (traditional song)&returntoquery=action=edit&mobileaction=toggle_view_mobile&type=signup (proxied via 10.64.32.107 forwarded for 137.110.244.139, 10.128.0.110, 10.128.0.108) anon
/a/mw-log/test2wiki.log:Start request GET /w/index.php?title=Bahrain&action=edit&mobileaction=toggle_view_mobile
/a/mw-log/test2wiki.log:Start request GET /w/index.php?title=Kyrgyzstan&action=edit&mobileaction=toggle_view_mobile
/a/mw-log/test2wiki.log:Start request GET /w/index.php?title=Special:UserLogin&returnto=Talk%3AAlbum&returntoquery=action%3Dedit%26redlink%3D1%26mobileaction%3Dtoggle_view_mobile&type=signup
/a/mw-log/test2wiki.log:20140228122857 0.101 /w/index.php?title=Special:UserLogin&returnto=Talk:Album&returntoquery=action=edit&redlink=1&mobileaction=toggle_view_mobile&type=signup (proxied via 10.64.0.103 forwarded for 137.110.244.139, 10.128.0.118, 10.128.0.110) anon
/a/mw-log/test2wiki.log:Start request GET /w/index.php?title=Talk:Nepal&action=edit&redlink=1&mobileaction=toggle_view_mobile
/a/mw-log/test2wiki.log:Start request GET /w/index.php?title=Rule&action=edit&redlink=1&mobileaction=toggle_view_mobile
/a/mw-log/test2wiki.log:Start request GET /w/index.php?title=Bluebook&action=edit&redlink=1&mobileaction=toggle_view_mobile
/a/mw-log/test2wiki.log:Start request GET /w/index.php?title=User:RobLa-WMF&mobileaction=toggle_view_mobile
/a/mw-log/test2wiki.log:Start request GET /w/index.php?title=Special:UserLogin&type=signup&returnto=Jazz&returntoquery=action%3Dedit%26redlink%3D1%26mobileaction%3Dtoggle_view_mobile
/a/mw-log/test2wiki.log:20140228191618 0.098 /w/index.php?title=Special:UserLogin&type=signup&returnto=Jazz&returntoquery=action=edit&redlink=1&mobileaction=toggle_view_mobile (proxied via 10.64.32.107 forwarded for 137.110.244.139, 10.128.0.110, 10.128.0.118) anon
/a/mw-log/test2wiki.log:Start request GET /w/index.php?title=Justice&action=edit&redlink=1&mobileaction=toggle_view_mobile
/a/mw-log/test2wiki.log:Start request GET /w/index.php?title=Template:Orphan&action=edit&mobileaction=toggle_view_mobile

Alright, I can't gracefully fix this without some consultation from the Zero team, so the change that introduced this bug is reverted (but not deployed):
https://gerrit.wikimedia.org/r/#/c/116174/

Merged, deployed. All seems OK now.