A WSOD is a pretty horrible thing from a UX perspective- absolutely no feedback that an error has even occurred. I think we could make this experience a little less traumatic by using register_shutdown_function to at least tell users 'sorry, an error has occurred', such as with the attached patch.

Issue fork drupal-1135066

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

robloach’s picture

Title: Use register_shutdown_function to 'avoid' WSODs » No more White Screen Of Death (graceful shutdown)
Component: other » base system
Status: Active » Needs review
Issue tags: +WSOD
StatusFileSize
new1.04 KB

I like the idea a lot! The WSOD is definitely not something that's nice to get. If we provide a simplistic page with some details as to what happened, it might have both on the user perspective and the developer's. This patch moves it into part of the bootstrap instead of index.php, and uses drupal_register_shutdown_function().

Should this use the maintenance page to display the message? Should we provide more information about the error that occurred?

danepowell’s picture

Well, if there was some sort of fatal error, I don't know that we should rely on much of anything working, including the maintenance page. In an ideal world, maybe there could be some sort of graceful shutdown process, where if there's a bad shutdown, you try to display a nice maintenance page, and if THAT fails too, just give a white screen with "sorry, an error has occurred".

As for displaying errors: I don't think we should display them by default, as that could be a security risk. But maybe it could be user configurable, or maybe it could be based on PHP settings?

Josh The Geek’s picture

Why not include the 500 header while you're at it? Internal server error is a good description of the problem. If that's the case, do you have to include the output anyway?

wapnik’s picture

Why not display some sort of Drupal debug output, if the user is admin or has permission. Could be done in a pluggable way, to make it possible for tools like this to work with Drupal (probably through a wrapper module).

wapnik’s picture

Lets pretend someone wants to build a Drupal specific debugger. A tool which indicates an error/message even if php itself does not. Can be in these cases:

  • bad hook implementation
  • function name in a module starts with something which differs to the module's name
  • ...

Help me find other points here, please.

Or is it a modification of the coder module that what i want in core?

danepowell’s picture

This all sounds great, but like I said- if there's a fatal error, I don't think we should count on being able to bootstrap Drupal (to check user permissions), or do much of anything really, other than say "Sorry".

wapnik’s picture

Maybe i should file another issue for this debugger. This needs some experiments first. Can we read settings.php before the error occur? Let's say an error in a module file.

wapnik’s picture

I just got that Nette\Debug working with Drupal, using the code from comment #1. Tested by adding random characters to theme's template.php, system.module, a settings.php file, debugger works as expected. Which is enough for a contrib developer. I'll try to make it pluggable now, put it out of core, if possible, try to figure out the strategy when to use it...

rfay’s picture

Another approach in #1159422: Death to WSOD: Output information about what caused a fatal error. There I'm just trying to give a little information about what has happened.

rfay’s picture

If you're testing: I created an error-creating fatal module for testing.

rfay’s picture

Status: Needs review » Needs work

Will need a reroll after the core patch went in.

traviscarden’s picture

Status: Needs work » Needs review
StatusFileSize
new1.05 KB

Here's a patch to get the ball rolling again.

cweagans’s picture

Status: Needs review » Needs work

Still a couple issues to work out here:

1) How do we deal with translation of that string? Or at least allowing it to be overridden without a core hack?
2) Is there a clean way to show the maintenance page in that situation? If so, then I think we should.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Issue summary: View changes
Issue tags: -

From what I can tell this may still be valid. #1159422: Death to WSOD: Output information about what caused a fatal error was closed a duplicate a month ago.

rpayanm made their first commit to this issue’s fork.

rpayanm’s picture

Status: Needs work » Needs review

Please review.

smustgrave’s picture

Status: Needs review » Needs work

Needs test coverage.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.