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.
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-cookiethat 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 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 commentedFix patch from #22 to drupal 9.5
Comment #25
vvs commentedupd
Comment #26
mebel192 commentedOriginal Text : Après avoir cherché en profondeur la cause possible de l’erreur, il se peut que certaines extensions de navigateur qui injectent du code dans l’en-tête de la page provoquent une erreur avec BigPipe. Essayez de désactiver certaines extensions de votre navigateur pour identifier laquelle pose problème.
After thoroughly investigating the possible cause of the error, it may be that some browser extensions that inject code into the page head tag are causing an error with BigPipe. Try disabling certain extensions in your browser to identify which one is causing the problem.