Page MenuHomePhabricator

PHP warning on attempting to set a block cookie after CentralAuth auto login
Closed, ResolvedPublic

Description

Error

Request URL: /wiki/Special:CentralAutoLogin/toolslist?returnto=Module%3ACitation%2FCS1&returntoquery=
Request ID: XShC5QpAAEAAAJ6X@I0AAAAG

Message:

PHP Warning: Cannot modify header information - headers already sent by (output started at /srv/mediawiki/php-1.34.0-wmf.13/extensions/CentralAuth/includes/specials/SpecialCentralAutoLogin.php:646)

Trace:

#0 [internal function]: MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /srv/mediawiki/php-1.34.0-wmf.13/includes/WebResponse.php(208): setcookie(string, string, integer, string, string, boolean, boolean)
#2 /srv/mediawiki/php-1.34.0-wmf.13/includes/block/BlockManager.php(493): WebResponse->setCookie(string, string, string, array)
#3 /srv/mediawiki/php-1.34.0-wmf.13/includes/block/BlockManager.php(460): MediaWiki\Block\BlockManager->setBlockCookie(MediaWiki\Block\DatabaseBlock, WebResponse)
#4 /srv/mediawiki/php-1.34.0-wmf.13/includes/deferred/MWCallableUpdate.php(38): MediaWiki\Block\BlockManager->MediaWiki\Block\{closure}()
#5 /srv/mediawiki/php-1.34.0-wmf.13/includes/deferred/DeferredUpdates.php(309): MWCallableUpdate->doUpdate()
#6 /srv/mediawiki/php-1.34.0-wmf.13/includes/deferred/DeferredUpdates.php(265): DeferredUpdates::attemptUpdate(MWCallableUpdate, Wikimedia\Rdbms\LBFactoryMulti)
#7 /srv/mediawiki/php-1.34.0-wmf.13/includes/deferred/DeferredUpdates.php(217): DeferredUpdates::handleUpdate(MWCallableUpdate, Wikimedia\Rdbms\LBFactoryMulti, string, integer)
#8 /srv/mediawiki/php-1.34.0-wmf.13/includes/deferred/DeferredUpdates.php(140): DeferredUpdates::handleUpdateQueue(array, string, integer)
#9 /srv/mediawiki/php-1.34.0-wmf.13/includes/MediaWiki.php(600): DeferredUpdates::doUpdates(string, integer)
#10 /srv/mediawiki/php-1.34.0-wmf.13/includes/MediaWiki.php(566): MediaWiki::preOutputCommit(RequestContext, Closure)
#11 /srv/mediawiki/php-1.34.0-wmf.13/includes/MediaWiki.php(900): MediaWiki->doPreOutputCommit(Closure)
#12 /srv/mediawiki/php-1.34.0-wmf.13/includes/MediaWiki.php(515): MediaWiki->main()
#13 /srv/mediawiki/php-1.34.0-wmf.13/index.php(42): MediaWiki->run()
#14 /srv/mediawiki/w/index.php(3): require(string)
#15 {main}

Impact

The attempt to set the block cookie fails for this page load. I'd expect the block cookie to be set successfully on returning to the page that the user was originally attempting to access.

Notes

This seems to be related to https://gerrit.wikimedia.org/r/#/c/mediawiki/core/+/519177/ which defers setting the block cookie. The attempt to set the cookie now happens after SpecialCentralAutoLogin has output the personal tools list, which is too late.

Event Timeline

Restricted Application added subscribers: MGChecker, Aklapper. · View Herald TranscriptJul 12 2019, 4:16 PM

Assuming this task is about MediaWiki-extensions-CentralAuth / MediaWiki-User-management hence adding project tag so others can find this task under that project.

Niharika changed the subtype of this task from "Task" to "Bug Report".Jul 31 2019, 3:20 PM

Holding off on this until we have finished our work on improving block messaging.

aezell added a subscriber: aezell.

This will be solved by other tasks moving some function calls around.

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

This should be fixed since https://gerrit.wikimedia.org/r/#/c/mediawiki/core/+/534933/ which removed the DeferredUpdates from the BlockManager.

(Longer term, fixing T227005 and T227007 will prevent the circular dependency that the DeferredUpdates was designed to fix.)

Krinkle added a subscriber: Krinkle.Oct 8 2019, 8:44 PM

Checking logstash at https://logstash.wikimedia.org/goto/e657a826600cba383adc1d7080a1d463.

Sample from today:

PHP Warning: Cannot modify header information - headers already sent by (output started at /srv/mediawiki/php-1.34.0-wmf.25/extensions/CentralAuth/includes/specials/SpecialCentralAutoLogin.php:654)

#0 [internal function]: MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /srv/mediawiki/php-1.34.0-wmf.25/includes/WebResponse.php(208): setcookie(string, string, integer, string, string, boolean, boolean)
#2 /srv/mediawiki/php-1.34.0-wmf.25/includes/block/BlockManager.php(503): WebResponse->setCookie(string, string, string, array)
#3 /srv/mediawiki/php-1.34.0-wmf.25/includes/block/BlockManager.php(466): MediaWiki\Block\BlockManager->setBlockCookie(MediaWiki\Block\DatabaseBlock, WebResponse)
#4 /srv/mediawiki/php-1.34.0-wmf.25/includes/deferred/MWCallableUpdate.php(38): MediaWiki\Block\BlockManager->MediaWiki\Block\{closure}()
#5 /srv/mediawiki/php-1.34.0-wmf.25/includes/deferred/DeferredUpdates.php(383): MWCallableUpdate->doUpdate()
#6 /srv/mediawiki/php-1.34.0-wmf.25/includes/deferred/DeferredUpdates.php(281): DeferredUpdates::attemptUpdate(MWCallableUpdate, Wikimedia\Rdbms\LBFactoryMulti)
#7 /srv/mediawiki/php-1.34.0-wmf.25/includes/deferred/DeferredUpdates.php(226): DeferredUpdates::run(MWCallableUpdate, Wikimedia\Rdbms\LBFactoryMulti, Monolog\Logger, BufferingStatsdDataFactory, string)
#8 /srv/mediawiki/php-1.34.0-wmf.25/includes/deferred/DeferredUpdates.php(145): DeferredUpdates::handleUpdateQueue(array, string, integer)
#9 /srv/mediawiki/php-1.34.0-wmf.25/includes/MediaWiki.php(616): DeferredUpdates::doUpdates(string, integer)
#10 /srv/mediawiki/php-1.34.0-wmf.25/includes/MediaWiki.php(582): MediaWiki::preOutputCommit(RequestContext, Closure)
#11 /srv/mediawiki/php-1.34.0-wmf.25/includes/MediaWiki.php(916): MediaWiki->doPreOutputCommit(Closure)
#12 /srv/mediawiki/php-1.34.0-wmf.25/includes/MediaWiki.php(527): MediaWiki->main()
#13 /srv/mediawiki/php-1.34.0-wmf.25/index.php(44): MediaWiki->run()
#14 /srv/mediawiki/w/index.php(3): require(string)
#15 {main}

EDIT: I see the patch, while merged ~ 7 days ago, didn't make the cut. Will check back after Thursday.

@Krinkle Sorry should have clarified - this should be fixed in 1.35.0-wmf.1

Niharika closed this task as Resolved.Oct 12 2019, 1:56 AM
Niharika triaged this task as Medium priority.

@Krinkle Sorry should have clarified - this should be fixed in 1.35.0-wmf.1

Looks like this has happened. I don't see any more errors in logstash since yesterday. Closing this ticket. Thanks all!