Problem/Motivation

In #2469431: BigPipe for auth users: first send+render the cheap parts of the page, then the expensive parts, we made sure BigPipe's no-JS detection doesn't interfere with the batch system's no-JS detection by disabling BigPipe on the system.batch_page.html route.

However, turns out that if you invoke ModuleInstaller during batch, which happens while syncing config (ConfigSync), that route rebuilding is not done immediately, which leaves the router in an inconsistent state, which can in turn cause BigPIpe to not know it shouldn't do it's no-JS detection. This is caused by #2589967: Rebuild routes immediately when modules are installed.

(See #5 for detailed root cause analysis.)

Proposed resolution

Since route rebuilding runs too late, \Drupal\big_pipe\EventSubscriber\NoBigPipeRouteAlterSubscriber::onRoutingRouteAlterSetNoBigPipe() also isn't called, and hence the _no_big_pipe route option is set for the system.batch_page.html route too late.

Hence the work-around is to hardcode it for now, until #2589967: Rebuild routes immediately when modules are installed is fixed.

Patch at #5.

Remaining tasks

Review.

User interface changes

None.

API changes

None.

Data model changes

None.

Comments

Wim Leers created an issue. See original summary.

wim leers’s picture

Status: Active » Needs review
StatusFileSize
new5.83 KB
wim leers’s picture

StatusFileSize
new1.08 KB

The IS says:

[still working on finding the exact root cause]

Apply this patch to HEAD (without #2) and run ConfigImportAllTest. Now it will fail/stop at the point where a BigPipe no-JS <meta> refresh is added to a page that already has the Batch no-JS <meta> refresh. Which is exactly the thing we're working to understand.

wim leers’s picture

I found the root cause.

  1. Config syncing causes modules to be installed/uninstalled.
  2. This causes routes rebuilds.
  3. \Drupal\big_pipe\EventSubscriber\NoBigPipeRouteAlterSubscriber::onRoutingRouteAlterSetNoBigPipe() is called too late/in a separate request, which leaves the rebuilt routes without the route options that it sets
  4. That in turn causes this to not return early:
    function big_pipe_page_attachments(array &$page) {
      // Routes that don't use BigPipe also don't need no-JS detection.
      if (\Drupal::routeMatch()->getRouteObject()->getOption('_no_big_pipe')) {
        return;
      }
    

    … because that route option simply is not yet set.

  5. Proof is that the output on the verbosely output response contains this:
    <p route_name="system.batch_page.html" _no_big_pipe="false"></p>
    

    It should always look like this:

    <p route_name="system.batch_page.html" _no_big_pipe="true"></p>
    

So, the root cause is the routing system. Probably #2589967: Rebuild routes immediately when modules are installed.

wim leers’s picture

StatusFileSize
new564 bytes

Based on the research in #4, this should work, and local testing proves it does.

(With HEAD, ConfigImportAllTest fails 100% of the time locally, with this patch, 0%.)

wim leers’s picture

Title: Fix random BigPipe-induced fail in ConfigImportAllTest » Fix random fail in ConfigImportAllTest caused by ModuleInstaller not rebuilding routes immediately, which happens to be surfaced by BigPipe

More accurate title.

wim leers’s picture

Issue summary: View changes

IS updated with root cause.

wim leers’s picture

Issue summary: View changes

IS updated with final proposed resolution.

swentel’s picture

Status: Needs review » Reviewed & tested by the community

ConfigImportAllTest is green - so let's do this.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 94d96b4 and pushed to 8.1.x. Thanks!

  • alexpott committed 94d96b4 on 8.1.x
    Issue #2679547 by Wim Leers: Fix random fail in ConfigImportAllTest...
alexpott’s picture

Category: Task » Bug report
Priority: Normal » Critical

I;e committed this during the commit freeze because it was holding back adding the migrate ui to core - a key target for 8.1.0 - and actaully this issue should have been critical.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.