Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Problem/Motivation
Under some circumstances, BigPipe throws PHP notices because it tries to explode on <drupal-big-pipe-scripts-bottom-marker>
in \Drupal\big_pipe\Render\BigPipe::sendPreBody(), while that marker is missing.
This seems to happen when subrequests are created via DefaultExceptionHtmlSubscriber with javascript disabled.
Notices:
Notice: Undefined offset: 1 in Drupal\big_pipe\Render\BigPipe->sendPreBody() (line 143 of core/modules/big_pipe/src/Render/BigPipe.php).
Notice: Undefined offset: 2 in Drupal\big_pipe\Render\BigPipe->sendPreBody() (line 143 of d8/core/modules/big_pipe/src/Render/BigPipe.php).
Steps to reproduce:
On a fresh D8.1.x, create some content, disable javascript in your browser, visit /page-does-not-exist: this should trigger the above notices in the log.
Comment | File | Size | Author |
---|---|---|---|
#25 | 2679867-25.patch | 941 bytes | VVS |
#24 | 2679867-24.patch | 1020 bytes | VVS |
#22 | 2679867-22.patch | 1.01 KB | joseph.olstad |
#5 | 2679867-5.patch | 3.54 KB | Wim Leers |
Comments
Comment #2
Wim LeersReproduced. Thanks for the bug report! Working on test + fix.
Comment #3
Wim LeersComment #4
Wim LeersThe root cause is this wrong assumption:
Comment #5
Wim LeersComment #6
Wim LeersThis should also be backported to https://www.drupal.org/project/big_pipe.
Comment #9
Wim LeersComment #10
Wim Leers#2652766: PHP notice on page not found (when JS is disabled) was opened long before this, but the steps to reproduce were missing there. Berdir just reopened it with STR basically identical to this one. I closed that as a duplicate of this one.
Comment #11
BerdirThanks for the reference, somehow I only found the old issue, not this one.
Note that interestingly, I only got a single notice for 2, not 1. Although manual debugging showed that the explode only returned an array with a single key. I'll test this tomorrow.
I also don't have JS disabled, but maybe the issue title isn't correct about that?
Comment #12
mr.baileysTechnically it is the presence of the
big_pipe_nojs-cookie
that triggers the warnings.BigPipe::sendPreBody()
returns early if there are no no-js placeholders, so the code throwing the warnings is only reached if there is at least one no-js placeholder. Wim concluded the same in #2652766-4: PHP notice on page not found (when JS is disabled).I reviewed the patch and tested it with the BigPipe Demo blocks on both the system 40x messages as well as the custom 40x pages and can confirm that BigPipe works as expected for those subrequests, and no more notices are reported. The test added in #3 (https://www.drupal.org/pift-ci-job/199413) correctly triggers/tests the notices, and the patch in #5 makes the test pass.
Comment #13
Wim LeersI think #12 is alluding to it, but I'll spell it out explicitly for #11: @Berdir, perhaps you don't have JS disabled, but you still have the BigPipe no-JS cookie?
Comment #14
BerdirConfirmed, this fixes it for me as well.
Comment #15
Wim LeersPerfect :)
Comment #16
Fabianx CreditAttribution: Fabianx as a volunteer commentedRTBC + 1
Comment #17
alexpottLess complexity and more tests - nice!
Committed 30cf748 and pushed to 8.1.x and 8.2.x. Thanks!
Comment #20
Wim LeersAlso committed & pushed to the contrib module for Drupal 8.0: http://drupalcode.org/project/big_pipe.git/commit/f0a2205.
Comment #22
joseph.olstadThis isn't really fully fixed yet.
I created a module that takes data driven by linkchecker and does requests using Javascript that check for broken links on a site, it makes requests as fast as ajax can get the headers, doing this causes a zillion of these messages:
Fix is inspired by this idea:
https://stackoverflow.com/a/56971347
see patch:
Comment #23
joseph.olstadcreated a new issue for this, triggered tests and they all pass.
#3194462: BigPipe when server under heavy load results in PHP notices
Comment #24
VVS CreditAttribution: VVS as a volunteer commentedFix patch from #22 to drupal 9.5
Comment #25
VVS CreditAttribution: VVS as a volunteer commentedupd