View Issue Details

IDProjectCategoryView StatusLast Update
0002282XdebugStep Debuggingpublic2024-07-23 09:22
Reporterzaalbarxx Assigned Toderick  
PriorityhighSeveritycrashReproducibilityalways
Status resolvedResolutionno change required 
PlatformWindowsOSWindows 11OS Version23H2
Product Version3.3.2 
Summary0002282: XDebug crashes with XDEBUG_SESSION cookie
Description

Like I said in previous issues, there seem to be some issue with debugging with Xdebug when triggering it using a XDEBUG_SESSION cookie. When the cookie is set and set with the request Nginx returns:

502 Bad Gateway
nginx/1.25.2

After some checking it looks like it only happens with "web" requests as calling php in CLI with xdebug arguments properly triggers it and step debugging is working without crash.

So it appears that it may be a problem with Nginx/php-cgi.exe. Unfortunately I don't have much experience with debugging C errors, so I would gladly listen how to create some debug logs for it.

Steps To Reproduce
  1. Install valet-windows Composer package or Laravel Herd for Windows
  2. Install PHP 8.1 (also checked with 8.3, same issue)
  3. Configure PHP to use xdebug by placing DLL in C:\Users\%user%.config\herd\bin\php81\ext and configuring php.ini like:
    [xdebug]
    xdebug.client_host=127.0.0.1
    xdebug.client_port=9003
    xdebug.mode=debug
    xdebug.start_with_request = trigger;
  4. create example directory like test-php with index.php file and content
    <?php
    echo 'Hello world';                
  5. Add page in Herd using Settings -> Dashboard -> Open Sites -> Add -> Existing -> Select folder
  6. Go to the browser, enable XDebug Helper (adds cookie) and go to test-php.test
  7. It should fail with 502 Bad gateway
TagsNo tags attached.
Operating System
PHP Version8.1.30-8.1.39

Activities

zaalbarxx

2024-07-18 15:10

reporter   ~0007017

image.png (76,434 bytes)   
image.png (76,434 bytes)   
image-2.png (17,979 bytes)   
image-2.png (17,979 bytes)   
image-3.png (62,071 bytes)   
image-3.png (62,071 bytes)   
image-4.png (72,315 bytes)   
image-4.png (72,315 bytes)   
image-5.png (60,172 bytes)   
image-5.png (60,172 bytes)   

zaalbarxx

2024-07-18 15:17

reporter   ~0007018

What is quite important here, I think it only happens when triggering XDebug using XDEBUG_SESSION cookie, not when passing XDEBUG_SESSION query param, query param properly triggers XDebug, while cookie is crashing.

zaalbarxx

2024-07-18 15:26

reporter   ~0007019

After some more digging it looks like when I use XDEBUG_TRIGGER cookie instead of XDEBUG_SESSION/XDEBUG_PROFILE/XDEBUG_TRACE it will also work. A bit weird, any ideas ?

derick

2024-07-18 16:19

administrator   ~0007020

I don't have Windows, so I can't install "Laravel Herd for Windows".

Does it use PHP-FPM, or something else?

Are you sure it's not "Laravel Herd for Windows" causing the problem, perhaps it uses a weirdly compiled PHP. I have no idea, as I've never even heard of it.

After some more digging it looks like when I use XDEBUG_TRIGGER cookie instead of XDEBUG_SESSION/XDEBUG_PROFILE/XDEBUG_TRACE it will also work. A bit weird, any ideas ?

What does "it will also work" mean here? Does it mean you see a crash, or something else? In general, wherever you can use "XDEBUG_SESSION/XDEBUG_PROFILE/XDEBUG_TRACE" to get Xdebug's feature going, XDEBUG_TRIGGER should also trigger the features.

zaalbarxx

2024-07-18 18:57

reporter   ~0007023

I don't think so, previously I was using valet-windows which is just using Nginx/PHP-FPM/PHP (PHP was downloaded from official PHP repository) and the outcome was the same. I just switched to Herd yesterday to check if problem persists and sadly it does.

Yes, it looks like PHP-FPM is used, I see multiple php-cgi.exe being spawned (waiting for requests, I suppose).

By "it will also work" I mean that creating XDEBUG_TRIGGER cookie instead of XDEBUG_SESSION/XDEBUG_PROFILE/XDEBUG_TRACE will make XDebug work properly (without crash with 502). So it seems that it may be related to this "legacy" environment variables. It's just that the Chrome plugins are using old cookie names which in turn causes 502 error.

zaalbarxx

2024-07-18 19:00

reporter   ~0007024

Maybe you could provide some steps to gather some more information for debugging purposes like some backtraces or whatever is needed to investigate it further. But given that there are multiple reports of this 502 errors I think they may be related and there may be indeed something going on here.

zaalbarxx

2024-07-18 19:26

reporter   ~0007025

Ok, it turns out, at least for Herd, it is caused by https://github.com/beyondcode/herd-community/issues/731.
I guess this one can be closed then.
Thanks anyway, cheers!

derick

2024-07-23 09:22

administrator   ~0007027

Hi,

I do have these instructions listed on the website: https://xdebug.org/reporting-bugs

It used to be linked when you report an issue here. I'll have a look at adding that link again.

I'm glad you figured out what the problem is, and I shall be closing this ticket.

cheers,
Derick

Issue History

Date Modified Username Field Change
2024-07-18 15:04 zaalbarxx New Issue
2024-07-18 15:10 zaalbarxx Note Added: 0007017
2024-07-18 15:10 zaalbarxx File Added: image.png
2024-07-18 15:10 zaalbarxx File Added: image-2.png
2024-07-18 15:10 zaalbarxx File Added: image-3.png
2024-07-18 15:10 zaalbarxx File Added: image-4.png
2024-07-18 15:10 zaalbarxx File Added: image-5.png
2024-07-18 15:17 zaalbarxx Note Added: 0007018
2024-07-18 15:26 zaalbarxx Note Added: 0007019
2024-07-18 16:19 derick Assigned To => derick
2024-07-18 16:19 derick Status new => feedback
2024-07-18 16:19 derick Note Added: 0007020
2024-07-18 18:57 zaalbarxx Note Added: 0007023
2024-07-18 18:57 zaalbarxx Status feedback => assigned
2024-07-18 19:00 zaalbarxx Note Added: 0007024
2024-07-18 19:26 zaalbarxx Note Added: 0007025
2024-07-23 09:22 derick Status assigned => resolved
2024-07-23 09:22 derick Resolution open => no change required
2024-07-23 09:22 derick Note Added: 0007027