Page MenuHomePhabricator

PHP7 Timeout causes plaintext warning
Closed, ResolvedPublicPRODUCTION ERROR

Description

At https://en.wikipedia.org/wiki/Special:ProtectedPages

MediaWiki internal error.

Original exception: [XEparwpAIC0AAKvnybwAAACB] 2019-01-25 00:40:33: Fatal exception of type "Wikimedia\Rdbms\DBQueryError"

Exception caught inside exception handler.

Set $wgShowExceptionDetails = true; at the bottom of LocalSettings.php to show detailed debugging information.

Event Timeline

The timeout is nothing new, my preferences show 1000 entries by default, and that's too much for 60 seconds. Wondering if PHP7 accelerates this process enough to finish within 60 seconds, I opened the page, and received plaintext instead of the "usual" warning design. I guess this is relatively intentional and can be ignored.

I can reproduce the issue. This is the stack trace when running from PHP7:

https://logstash.wikimedia.org/goto/9e79897af941c80ed642eba775b32fd4

while this one is coming from a request to HHVM:

https://logstash.wikimedia.org/goto/ba7e285d9cf368e65779085f12aac60a

so it seems that the timeout being reached causes a mysql exception to be raised in PHP 7.2, while that doesn't happen in HHVM. I'll try to dig further if I have time today.

As I understand it, what's happening is:

  • In HHVM, a fatal error is raised
  • According to the setting hhvm.server.error_document500, it handles the error by executing /srv/mediawiki/errorpages/hhvm-fatal-error.php
  • php has no such setting, so we may need to add an exception handler when we're running on php7

I thought of just defining an error document handler for php only using ErrorDocument in apache, but that would mean we'd need to override *any* response with status 400 or above from PHP by setting ProxyOverride On.

So our best bet is to implement an exception handler that does what HHVM does with the error_document500 setting.

What is the difference to T214661?

This is about the (failure to) handle 500 errors from php7.

So, I found out the ultimate reason why the exception thrown by php7 is different from hhvm's:
right now, we use set_time_limit to limit the execution time of scripts to 60 seconds on GETs, but while HHVM uses wall clock time for calculating the time limit, PHP-FPM famously doesn't. So, we get an sql exception (not wrapped in a nice error page) instead of the usual timeout because of that.

@Joe so it sounds like DB errors and timeout errors are still handled the same in PHP7 as on HHVM.

On HHVM, DB errors are don't receive the HTML page layout.

It's just that this particular scenario produces a different error on PHP 7 as on HHVM. If that's all, I think we can close this.

mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:07 PM