-1

Cloudlinux Opcache (disabled)

This situation has me scratching my head, so hopefully someone can shed some light.

I have Xdebug working on a cPanel/WHM server hosted site using PhpStorm as the IDE and Xdebug helper on my browser to trigger the Xdebug session via an IDE key. EDIT: The debug.mode = debug.

Normally this all works fine, and I've been debugging things without issue until now. The situation now is that I have a weird 404 error that I'm trying to locate the cause of.

When the Xdebug session is disabled (via the browser plugin), the error happens (a 404 page not found) but when the Xdebug session is active (again via the browser) the page (when refreshed) displays as it was meant to.

Further symptoms/variables are that the bug doesn't happen when the visitor is logged into an account on the site, so my gut is telling me this might be something related to cookies or session data but the fact that Xdebug is affecting the outcome is both weird and frustrating because I can't debug a problem that doesn't exist when Xdebug is watching...

Any suggestions?

Update 1: After adding logging points manually in the code I've identified that the code does progress, ignoring the breakpoints it seems, and gets so far before a bug (potentially an ajax call) redirects the resulting output to a 404 not found instead of the 503 error I can see in the $_SESSION output.

Update 2: After further investigation I discovered that the issue is also triggered by the debug.mode setting.

debug and trace both cause issues (when xdebug session is inactive) profile, develop, gcstats and coverage do not trigger the 404.

Update 3: After checking compatibility matrix for Xdebug I checked opcache was off (it was) and then tried switching to PHP version 8.3 (down from 8.4 originally set). 8.3 works without the issue.

This explains why another site still on PHP 7.4 wasn't showing the same problem with debug turned on.

So to summarise:

  • PHP 8.4, xdebug.mode = debug/trace = strange incompatibility
10
  • Did you restart the webservice (apache/nginx) after disabling xdebug? Commented Nov 13 at 15:01
  • Heisenbug situation: The bug does not exist when you watch (xdebug = on). I'd say it's not the norm, but this is a thing, it even has its own Wikipedia entry: en.wikipedia.org/wiki/Heisenbug - so better not let the frustration win because you need to think a bit out of the box then. Often fruitful in the end. Commented Nov 13 at 15:11
  • 1
    Are you able to share some more details? E.g. is a specific request handling in place? What component is responsible to respond and/or delegates the HTTP status code? Are there places that send the 404 header? Do you have logging in place? Etc. Commented Nov 13 at 15:16
  • 1
    So if I get you right, the interesting part is where the code path diverges "only because xdebug is on" - at least in the intermediate as that poses the extra-work facing. If it helps, there is a function called xdebug_break(); you can place into the code which will create a debugger breakpoint there. It is easy to remove afterwards per search and replace, as easier to add than intermediate logging points (may depend, but most often while exploring temporarily). Commented Nov 14 at 5:28
  • 1
    @hakre Thank-you for the tip about incorporating xdebug_ commands in the code directly. I had missed that functionality so a useful nudge in the right direction. Commented Nov 14 at 9:57

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.