Page MenuHomePhabricator

504 Gateway Time-out errors after creating new formulas on pt.wikipedia
Closed, ResolvedPublic


I'm getting Time-out errors every time I review a math article and rewrite many of its formulas. The most recent example is

where I got

504 Gateway Time-out


But, if I remeber correctly, this edit also caused the same error:
and I'm certain there was more cases before this.

In all cases the edit seems to be saved anyway.

Maybe it is related to bug 53400?

Version: unspecified
Severity: normal
See Also:



Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 2:19 AM
bzimport set Reference to bz56769.
bzimport added a subscriber: Unknown Object (MLST).

When I tried to replicate the first edit above on English Wikipedia, the error was this:

Request: POST, from via cp1002.eqiad.wmnet (squid/2.7.STABLE9) to (
Error: ERR_READ_TIMEOUT, errno [No Error] at Fri, 08 Nov 2013 13:15:35 GMT
and the edit was not saved.

Then I tried again and it was saved without problem:

Then I used the content of the link
and got:
Request: POST, from via cp1008.eqiad.wmnet (squid/2.7.STABLE9) to (
Error: ERR_READ_TIMEOUT, errno [No Error] at Fri, 08 Nov 2013 13:26:34 GMT

but this time the edit was saved:

Helder: Is this still a problem?

Yes: I just copied the code from first link above to
and then made the replacement
/<math>/g --> <math>bug
to generate new formulas. The result was this (and the edit was not saved):

Request: POST, from via cp1052 frontend ([]:80), Varnish XID 1553287318
Forwarded for:,
Error: 503, Service Unavailable at Mon, 18 Nov 2013 10:00:15 GMT

Then (after a few minutes) I hit the back button from my browser and clicked save again. The edit was saved but the error persisted:

Request: POST, from via cp1068 frontend ([]:80), Varnish XID 3606772663
Forwarded for:,
Error: 503, Service Unavailable at Mon, 18 Nov 2013 10:04:59 GMT

On Portuguese Wikibooks, I also get an error message when I save edits in which lots of formulas[1] are changed:
Request: POST, from via cp1065 frontend ([]:80), Varnish XID 2785820477
Forwarded for:,
Error: 503, Service Unavailable at Wed, 20 Nov 2013 09:59:28 GMT

[1] Example:

It happened again:
Request: POST, from via cp1066 frontend ([]:80), Varnish XID 3663099635
Forwarded for:,
Error: 503, Service Unavailable at Wed, 20 Nov 2013 10:44:44 GMT

Some eval.php profiling.

$title = Title::newFromText( 'Math page' );

$text = ''; for ( $i=0; $i<100; ++$i ) { $text .= "<math>i = " . mt_rand( 0, 2000000000 ) . "</mat h>\n"; }

$content = ContentHandler::makeContent( $text, $title );

$content->getParserOutput( $title );


100.00% 93.631767 1 - -total
99.96% 93.597670 1 - Parser::parse
99.96% 93.597645 1 - Parser::parse-call_user_func_array
99.84% 93.479773 317 - PPFrame_DOM::expand
99.83% 93.474312 1 - Parser::internalParse
99.83% 93.472083 5 - Parser::replaceVariables
99.74% 93.385419 100 - MathHooks::mathTagHook
98.58% 92.301875 100 - MathTexvc::callTexvc
31.91% 29.878679 100 - FileBackendStore::doQuickOperationsInternal-global-swift
31.90% 29.865421 100 - FileBackendStore::storeInternal-global-swift
24.23% 22.683115 100 - FileBackendStore::doQuickOperationsInternal-global-swift-eqiad
24.21% 22.667449 100 - FileBackendStore::storeInternal-global-swift-eqiad

4.10% 3.843399    100 - FileBackendStore::doPrepare-global-swift
0.96% 0.894944    100 - FileBackendStore::doPrepare-global-swift-eqiad
0.79% 0.738057    100 - MathTexvc::writeCache
0.59% 0.550794    100 - DatabaseBase::query-master
0.58% 0.545479    100 - query-m: REPLACE INTO `math` (math_inputhash,math_outputhash,math_html_con                                                                        servativeness,math_html,math_mathml) VALUES ('X')

Change 103644 had a related patch set uploaded by Aaron Schulz:
Buffer png writes and flush them all at once

Change 103644 merged by Physikerwelt:
Buffer png writes and flush them all at once

physik wrote:

I'm really unhappy that nobody is reviewing math 2.0 which would resolve all the unnecessary interactions with the file system.
It takes a lot of time to manually rebase the change over and again.
Compar this change:
Uploaded Dec 25, 2013 9:39 AM
Updated Dec 27, 2013 11:42 AM (merged)
with that one
Uploaded Sep 24, 2013 2:28 AM

I was going to just wait, but it figured I may as well make a simple fix to help now. I did checkout Math 2.0 out of curiousity a few days ago, but all the pngs just were replaced with "texvc not found" errors and I ended up doing other things.

physik wrote:

Yes this happens if texvccheck is not compiled, since the binaries are ignored in the .gitignore file.
If you switch to texvccheck and run make there the problem should disappear.

Patch was merged a while ago - is there more work left to do here (if yes: please reset the bug report status to NEW or ASSIGNED), or can you close this ticket as RESOLVED FIXED?