symfony-docker icon indicating copy to clipboard operation
symfony-docker copied to clipboard

xdebug frozen any http request

Open vhb-Mark opened this issue 6 months ago • 16 comments

Hi all,

I have the weird issue that I can only make 1 request. I followed the steps to enable it in an existing project and the first request went fine.

But the second request stucks at the following step (enabled Caddy debug): 2023-12-24 14:53:06 2023/12/24 13:53:06.418 DEBUG http.handlers.rewrite rewrote request {"request": {"remote_ip": "192.168.65.1", "remote_port": "21823", "client_ip": "192.168.65.1", "proto": "HTTP/2.0", "method": "GET", "host": "localhost", "uri": "/", "headers": {"Sec-Fetch-Site": ["same-origin"], "Sec-Ch-Ua": [""Not_A Brand";v="8", "Chromium";v="120", "Google Chrome";v="120""], "Sec-Ch-Ua-Mobile": ["?0"], "Sec-Fetch-User": ["?1"], "Accept-Encoding": ["gzip, deflate, br"], "User-Agent": ["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"], "Accept": ["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.7"], "Upgrade-Insecure-Requests": ["1"], "Sec-Fetch-Dest": ["document"], "Cache-Control": ["max-age=0"], "Sec-Ch-Ua-Platform": [""macOS""], "Sec-Fetch-Mode": ["navigate"], "Accept-Language": ["nl-NL,nl;q=0.9,en-US;q=0.8,en;q=0.7"]}, "tls": {"resumed": false, "version": 772, "cipher_suite": 4865, "proto": "h2", "server_name": "localhost"}}, "method": "GET", "uri": "/index.php"}

Anyone got an idea what this could be?

With. kind regards,

vhb-Mark avatar Dec 24 '23 13:12 vhb-Mark

Hi

I don't understand your issue. The log you shared shows nothing. Just that the request has been received by the server.

maxhelias avatar Dec 25 '23 17:12 maxhelias

I think i have same issue. After running container with XDEBUG_MODE=debug env and xdebbuger enabeled, I can debug and use break points only 1 request. When first request is finished, then second requests "hangs" and nothing happens.

grambas avatar Dec 30 '23 14:12 grambas

I can confirm the issue when using xdebug make debug.

EofChris avatar Jan 03 '24 14:01 EofChris

Same problem here, maybe I'm doing something wrong. I forked the project and tried to reproduce some of my own code architecture for debugging sake, here's the link: https://github.com/Narthall/symfony-docker

There's a branch called "reproducible-bug". Just run make build && make up, and try, for example, registering and then logging in (https://localhost/back/register, https://localhost/back/login). You'll likely never get to https://localhost/back/home.

Here's how I configured my PhpStorm: Capture d'écran 2024-01-16 144442

EDIT: Moreover, the Symfony profiler debug toolbar is not always displayed when Xdebug Debug is enabled.

EDIT 2: After more investigation, it seems like it is not handling properly the routes related to login and logout. It performs the action, and the redirection to the next web page is sent, but my navigator (Firefox Developer Edition) never receives it. I haven't tried with a different navigator.

Narthall avatar Jan 16 '24 13:01 Narthall

I have the same problem.

I don't think I've changed anything in my configuration (it used to work fine) so I guess the problem is probably gonna be with frankenphp server

noximo avatar Jan 20 '24 17:01 noximo

tl;dr; Use the command XDEBUG_MODE=off docker-compose up --detach --remove-orphans to spin up your containers

This sounds very similar to the issue that I am having. My app requires that a user is logged into the app. So opening a fresh browser and navigating to https://localhost seems to hang. Looking at the requests, it loads fine and redirects the user to /login. This is where it hangs. Now I can go directly to /login and it loads fine. Once I submit my username/password, it hangs again.

I have a Makefile that has up defined. All it does it run the command XDEBUG_MODE=develop docker-compose up --detach --remove-orphans. HOWEVER, when I change this to XDEBUG_MODE=off docker-compose up --detach --remove-orphans everything works as expected. It redirects the app correctly and everything still works. Not exactly why this is, but this should hopefully help someone resolve the issue.

JoshuaEstes avatar Feb 06 '24 21:02 JoshuaEstes

tl;dr; Use the command XDEBUG_MODE=off docker-compose up --detach --remove-orphans to spin up your containers

This sounds very similar to the issue that I am having. My app requires that a user is logged into the app. So opening a fresh browser and navigating to https://localhost seems to hang. Looking at the requests, it loads fine and redirects the user to /login. This is where it hangs. Now I can go directly to /login and it loads fine. Once I submit my username/password, it hangs again.

I have a Makefile that has up defined. All it does it run the command XDEBUG_MODE=develop docker-compose up --detach --remove-orphans. HOWEVER, when I change this to XDEBUG_MODE=off docker-compose up --detach --remove-orphans everything works as expected. It redirects the app correctly and everything still works. Not exactly why this is, but this should hopefully help someone resolve the issue.

But this is disabling debugging completly, isn't it?

EofChris avatar Feb 14 '24 09:02 EofChris

At first it looks like a compatibility issue with xdebug.

See :

  • https://github.com/dunglas/frankenphp/issues/563
  • https://github.com/dunglas/frankenphp/issues/538

maxhelias avatar Feb 14 '24 12:02 maxhelias

I have the same issue, when trying to debug a PHP microservice with xDebug enabled, while debugging one request, all other requests are doing timeouts. Being using xDebug for a while now without any issue like that, so I'm suspecting it's the way FrankenPHP is working that has an issue with xDebug ?

Renrhaf avatar Feb 14 '24 13:02 Renrhaf

Hello everyone, As pointed out by @gponty here: https://github.com/dunglas/frankenphp/issues/578#issuecomment-1954636647 It seems like it is a Xdebug problem: https://bugs.xdebug.org/view.php?id=2216 But it is encountered with Apache, nobody encountered it with Caddy in the Xdebug report thread. I'm completely new to Caddy, does someone have sufficient experience to see if it is related?

Narthall avatar Feb 21 '24 09:02 Narthall

@Narthall The issue pointed out by @gponty seems to me to be another issue, because the author refers to a long time execution in worker mode and never mentions xdebug.

The xdebug error seems to be correctly identified no matter what the frankenphp mode is and without any link to the server you use. (see : https://github.com/dunglas/frankenphp/issues/563#issuecomment-1949376702)

maxhelias avatar Feb 21 '24 13:02 maxhelias

also faced with similar problem, not sure is it connected to xdebug or not. randomly at some point app just stop working (dev env), docker logs php -f doesn't show incoming request when I refresh page, browser shows infinite loading. only docker compose stop && docker compose up --detach fixes the problem.

c1tru55 avatar Mar 07 '24 19:03 c1tru55

This seems to be this bug: https://bugs.xdebug.org/view.php?id=2216

Tracked here for FrankenPHP (but this looks unrelated to FrankenPHP, this also affects Apache mod_php in ZTS mode): https://github.com/dunglas/frankenphp/issues/563

A reproducer (a minimal Docker image and a minimal failing script) would likely help a lot the XDebug team.

dunglas avatar Mar 07 '24 22:03 dunglas

I am facing the same exact issue with the latest frankenphp image in my symfony 7 project.

After a few requests when Xdebug is enabled, the CPU goes up to 100%+ usage and I have to restart the container (every 1-2 minutes, which make development impossible)

I switched the frankenphp image used in the Dockerfile to dunglas/frankenphp:sha-c00a011-php8.2.16-alpine and it seems to have fixed the problem for now (If you don't have any vendor requiring php 8.3+ that should do the trick) until a permanent fixed is available for php 8.3

rygarok avatar Mar 11 '24 17:03 rygarok

Interesting @rygarok, thanks for sharing this workaround.

Could you tell me what version of XDebug is installed with 8.2?

dunglas avatar Mar 12 '24 08:03 dunglas

Interesting @rygarok, thanks for sharing this workaround.

Could you tell me what version of XDebug is installed with 8.2?

Xdebug version for this specific frankenphp image is 3.3.1

rygarok avatar Mar 13 '24 18:03 rygarok

Closed by https://github.com/xdebug/xdebug/pull/958.

dunglas avatar Apr 02 '24 10:04 dunglas