Page MenuHomePhabricator

Math extension has problem with MultiHttpClient and http/2 requests on Linux
Closed, ResolvedPublic



I've been trying to install the Math extension to no avail. From, I should only need to copy the Math extension files into the proper extensions directory. In this case, formulas are rendered as pure text; nothing happens; so, can't get installation "out of the box."

When I add "wfLoadExtension( 'Math' );" to the LocalSettings.php file, I instead get the error: 'Invalid response ("Math extension cannot connect to Restbase.") from server "":).'

php-curl is installed; not sure what else I can try. Thanks in advance.

Event Timeline


wfLoadExtension( 'Math' );
is indeed required. Why your wiki can't connect to the Wikimedia Rest API is not clear to me. Is your wiki connected to the internet and allowed to access the URL via https?

This sounds like a support request (to be handled in support forums) but not necessarily like a bug report...

@Aklapper could you please point @Gardas603 to the appropriate support forum?

@Physikerwelt: It may be worth changing the text "See this thread for information on how to install this extension for MediaWiki 1.31 and later." in, since the referred thread then seems to imply that there is no need to edit LocalSettings.php. Thank you very much for the help.

@Aklapper: I wasn't sure whether this was a bug, but thanks for the link. I got here by following the instructions in and I'll refer to the Extension_talk link you provided.

Thanks both!

Not sure if @Gardas603 has found a solution yet, but I was experiencing a similar issue on MediaWiki 1.32 (I'm on macOS Sierra), and I traced the error back to the MultiHttpClient in the core. My server was receiving an HTTP/2 200 response from the Restbase, but the regex match in MultiHttpClient responsible for parsing out the response code is hard coded to expect HTTP/1.x, so the match fails and the default code 0 is never properly overwritten. And then the Math extension's MathRestbaseInterface complains because it only accepts code 200.

I tried hacking around, and these two changes both individually seemed to resolve the issue for me:

  1. Changing all checks in MathRestbaseInterface.php to accept a code 0 response. Related to this discussion, but taking OP's attempted solution even farther.
  2. Modifying the regex in MultiHttpClient to properly match either an HTTP/1.x or an HTTP/2 response code.

It seems like MultiHttpClient is undergoing some changes with T202352, so maybe this issue will inadvertently be fixed in future releases?

Ciencia_Al_Poder added a subscriber: Ciencia_Al_Poder.

This is indeed a problem with MultiHttpClient and http/2 requests.

Apparently, some php versions try to use http/2 by default for curl. This is something that's going to hit WMF production sooner or later

Aklapper renamed this task from Can't get Math extension to work (Linux) to Math extension has problem with MultiHttpClient and http/2 requests on Linux.Aug 21 2019, 10:41 PM
Physikerwelt claimed this task.

The underlying issue was resolved I think.