View Issue Details

IDProjectCategoryView StatusLast Update
0002168XdebugUncategorizedpublic2024-04-15 13:28
Reporterjohn@unifi.credit Assigned Toderick  
PrioritylowSeverityminorReproducibilityrandom
Status resolvedResolutionsuspended 
PlatformLinuxOSUbuntuOS Version 22.04
Product Version3.1.2 
Summary0002168: Flush not guaranteed
Description

This happened on a PHP project without any framework (such as Laravel) on Apache and PHP 8.1 FPM.

I am working on a PHP site that had the odd behaviour of returning empty content to an AJAX request randomly but then I found a specific value (part of JSON POST) that would consistently cause an empty response. Debugging the handler showed no sign of any problem. The JSON response was echoed in the very last line of the code and after that destructors were called. By adding flush() at the end of the script, the problem was solved. At first I suspected a destructor caused an exception which might then cause a flush not to be done. I switched on tracing and found the names of destructors and commented them out (commented flush out as well). This did not fix the problem and then I disabled XDebug after which the PHP response was returned as expected without fail. The moment I enabled XDebug again, the problem persisted again.

This problem is not consistent. The value I mentioned earlier was a numeric value (ID number) and the only time I was able to consistently cause the problem was for a specific ID that happened to start with 2 zeros. On other values the problem happened sporadically and sometimes not at all. My best guess is that there is a specific state in XDebug which prevents a flush once the request is complete. Best guess would be that an exception is thrown in XDebug module which prevents PHP from calling the flush.

Steps To Reproduce

This issue is so sporadic that I believe there is very little chance anyone else can reproduce it consistently. Since I seem to have a silver bullet, I can help by generating an XDebug module log if someone can guide me on how to do this.

Tagsdebug
Operating SystemUbuntu 22.04
PHP Version8.1.0-8.1.4

Activities

derick

2023-08-01 10:13

administrator   ~0006623

Hi,

I am not sure if we'll ever find this out... but Xdebug should not mess with flushing at all.

If this is still a problem for you, an Xdebug log file while debugging (xdebug.log=/tmp/xdebug.log and xdebug.log_level=11) might be helpful, and perhaps create a trace at the same time (set xdebug.mode=develop,debug,trace, xdebug.start_with_request=yes, xdebug.collect_assignments=1, xdebug.collect_return=1) to correlate the issues.

cheers,
Derick

derick

2024-04-15 13:28

administrator   ~0006904

I am closing this, as there is no actionable task for me here, unless there is a reproducer. Which as you said, would be really hard to find.

I also believe, as I've already said, that Xdebug ought not to change anything with output buffers.

Issue History

Date Modified Username Field Change
2023-03-30 05:50 john@unifi.credit New Issue
2023-03-30 05:50 john@unifi.credit Tag Attached: debug
2023-08-01 10:13 derick Assigned To => derick
2023-08-01 10:13 derick Status new => feedback
2023-08-01 10:13 derick Note Added: 0006623
2024-04-15 13:28 derick Status feedback => resolved
2024-04-15 13:28 derick Resolution open => suspended
2024-04-15 13:28 derick Note Added: 0006904