The Wayback Machine - https://web.archive.org/web/20231128090658/https://github.com/symfony/symfony/issues/52721
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web profiler won't show occasionally (httputil: ReverseProxy read error during body copy: fcgi: invalid header version) #52721

Open
UrbiJr opened this issue Nov 24, 2023 · 1 comment

Comments

@UrbiJr
Copy link

UrbiJr commented Nov 24, 2023

Symfony version(s) affected

4.3, 6.3, 6.4

Description

I upgraded a SF 4.3 project to SF 6.3 (and now 6.4) - since the beginning (4.3) web profiler toolbar wasn't showing off on my browser (tried different browsers), unless loading a different template from base.html.twig.
At first I thought it was a firewall issue, but then I found out it actually pops out if I delete all render calls on base.html.twig:

<div class="container">
	{{ render(controller(
		'App\\Controller\\Website\\Base\\CompanyProfileController::getHeaderInfo'
		)) }}
	{{ render(controller(
		'App\\Controller\\Website\\Base\\WebsiteController::getUserMenu'
		)) }}
	{{ render(controller(
		'App\\Controller\\Website\\Base\\WebsiteController::getLanguageDropdownMenu'
		)) }}
</div>

to

<div class="container">
</div>

... along with a few more.
Deleting those calls, it will always show web profiler toolbar.
Without deleting them, it will show toolbar 1/10 times, 9/10 resulting in an error.

The only error "message" network tab is showing is: Failed to load resource data with target url https://127.0.0.1:8000/_wdt/d73375 .
If I open https://127.0.0.1:8000/_wdt/d73375 on a different tab, it will load it.
It may seem a php memory limit issue, so I set memory limit to 2048M, and then to -1 (no limit), without success.

I just noticed what could actually cause this weird behavior.
When it's not rendering, Symfony logs show this error:
httputil: ReverseProxy read error during body copy: fcgi: invalid header version

However I don't really know what to do with that.

How to reproduce

Try running a really heavy project (with a lot of SQL calls). Run symfony server:start and see if web profiler shows.
Just to give you an idea, here's the profiler data one of the few times it rendered.

Screenshot 2023-11-24 alle 17 48 26

Possible Solution

I just noticed what could actually cause this weird behavior.
When it's not rendering, Symfony logs show this error:
httputil: ReverseProxy read error during body copy: fcgi: invalid header version

On the other hand, when the profiler toolbar successfully renders, this error doesn't show at all.

Additional Context

No response

@UrbiJr
Copy link
Author

UrbiJr commented Nov 27, 2023

I found a "fix" by adding a timeout to vendor/web-profiler-bundle/Resources/views/Profiler/toolbar_js.html.twig :

(function () {
        setTimeout(function() {
            Sfjs.loadToolbar('{{ token }}');
        }, 3000);
    })();

I guess there are better ways but doing this it will just spawn 3 seconds after the page loaded.
I won't close this issue since it's not a proper fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants