warden: Xdebug 3 and PHP 8.1 - not working

When running a brand new install on Magento 2 using the below conifg, xdebug fails to break.

ELASTICSEARCH_VERSION=7.17 MARIADB_VERSION=10.4 NODE_VERSION=16 COMPOSER_VERSION=2 PHP_VERSION=8.1 PHP_XDEBUG_3=1 RABBITMQ_VERSION=3.9 REDIS_VERSION=6.2 VARNISH_VERSION=7.0

When downgrading the PHP version to 7.4 then the breakpoints work correct without changing any other config settings in the IDE.

This makes me believe it’s a 8.1 Image specific problem, debugging is out my remit but hopefully someone can shed some light.

[164] [Config] INFO: Trigger value for 'XDEBUG_TRIGGER' not found, falling back to 'XDEBUG_SESSION'
[164] [Config] INFO: No shared secret: Activating
[164] [Step Debug] INFO: Checking for client discovery headers: 'HTTP_X_DEBUG_HOST'.
[164] [Step Debug] INFO: Checking header 'HTTP_X_DEBUG_HOST'.
[164] [Step Debug] WARN: Could not discover client host through HTTP headers, connecting to configured address/port: localhost:9003.
[164] [Step Debug] WARN: Creating socket for 'localhost:9003', poll success, but error: Operation now in progress (29).
[164] [Step Debug] WARN: Creating socket for 'localhost:9003', connect: Cannot assign requested address.
[164] [Step Debug] ERR: Could not connect to debugging client. Tried: localhost:9003 (fallback through xdebug.client_host/xdebug.client_port).
[164] [Config] INFO: Trigger value for 'XDEBUG_TRIGGER' not found, falling back to 'XDEBUG_TRACE'
[164] [Config] INFO: Trigger value for 'XDEBUG_TRACE' not found, so not activating
[164] [Config] INFO: Trigger value for 'XDEBUG_TRIGGER' not found, falling back to 'XDEBUG_SESSION'
[164] [Config] INFO: No shared secret: Activating
[164] [Step Debug] INFO: Checking for client discovery headers: 'HTTP_X_DEBUG_HOST'.
[164] [Step Debug] INFO: Checking header 'HTTP_X_DEBUG_HOST'.
[164] [Step Debug] WARN: Could not discover client host through HTTP headers, connecting to configured address/port: localhost:9003.
[164] [Step Debug] WARN: Creating socket for 'localhost:9003', poll success, but error: Operation now in progress (29).
[164] [Step Debug] WARN: Creating socket for 'localhost:9003', connect: Cannot assign requested address.
[164] [Step Debug] ERR: Could not connect to debugging client. Tried: localhost:9003 (fallback through xdebug.client_host/xdebug.client_port).
[164] [Config] INFO: Trigger value for 'XDEBUG_TRIGGER' not found, falling back to 'XDEBUG_TRACE'
[164] [Config] INFO: Trigger value for 'XDEBUG_TRACE' not found, so not activating
[164] [Config] INFO: Trigger value for 'XDEBUG_TRIGGER' not found, falling back to 'XDEBUG_SESSION'
[164] [Config] INFO: No shared secret: Activating
[164] [Step Debug] INFO: Checking for client discovery headers: 'HTTP_X_DEBUG_HOST'.
[164] [Step Debug] INFO: Checking header 'HTTP_X_DEBUG_HOST'.
[164] [Step Debug] WARN: Could not discover client host through HTTP headers, connecting to configured address/port: localhost:9003.
[164] [Step Debug] WARN: Creating socket for 'localhost:9003', poll success, but error: Operation now in progress (29).
[164] [Step Debug] WARN: Creating socket for 'localhost:9003', connect: Cannot assign requested address.
[164] [Step Debug] ERR: Could not connect to debugging client. Tried: localhost:9003 (fallback through xdebug.client_host/xdebug.client_port).
[164] [Config] INFO: Trigger value for 'XDEBUG_TRIGGER' not found, falling back to 'XDEBUG_TRACE'
[164] [Config] INFO: Trigger value for 'XDEBUG_TRACE' not found, so not activating
[164] [Config] INFO: Trigger value for 'XDEBUG_TRIGGER' not found, falling back to 'XDEBUG_SESSION'
[164] [Config] INFO: No shared secret: Activating
[164] [Step Debug] INFO: Checking for client discovery headers: 'HTTP_X_DEBUG_HOST'.
[164] [Step Debug] INFO: Checking header 'HTTP_X_DEBUG_HOST'.
[164] [Step Debug] WARN: Could not discover client host through HTTP headers, connecting to configured address/port: localhost:9003.
[164] [Step Debug] WARN: Creating socket for 'localhost:9003', poll success, but error: Operation now in progress (29).
[164] [Step Debug] WARN: Creating socket for 'localhost:9003', connect: Cannot assign requested address.
[164] [Step Debug] ERR: Could not connect to debugging client. Tried: localhost:9003 (fallback through xdebug.client_host/xdebug.client_port).
[164] [Config] INFO: Trigger value for 'XDEBUG_TRIGGER' not found, falling back to 'XDEBUG_TRACE'
[164] [Config] INFO: Trigger value for 'XDEBUG_TRACE' not found, so not activating
[164] [Config] INFO: Trigger value for 'XDEBUG_TRIGGER' not found, falling back to 'XDEBUG_SESSION'
[164] [Config] INFO: No shared secret: Activating
[164] [Step Debug] INFO: Checking for client discovery headers: 'HTTP_X_DEBUG_HOST'.
[164] [Step Debug] INFO: Checking header 'HTTP_X_DEBUG_HOST'.
[164] [Step Debug] WARN: Could not discover client host through HTTP headers, connecting to configured address/port: localhost:9003.
[164] [Step Debug] WARN: Creating socket for 'localhost:9003', poll success, but error: Operation now in progress (29).
[164] [Step Debug] WARN: Creating socket for 'localhost:9003', connect: Cannot assign requested address.
[164] [Step Debug] ERR: Could not connect to debugging client. Tried: localhost:9003 (fallback through xdebug.client_host/xdebug.client_port).
[164] [Config] INFO: Trigger value for 'XDEBUG_TRIGGER' not found, falling back to 'XDEBUG_TRACE'
[164] [Config] INFO: Trigger value for 'XDEBUG_TRACE' not found, so not activating
[164] [Config] INFO: Trigger value for 'XDEBUG_TRIGGER' not found, falling back to 'XDEBUG_SESSION'
[164] [Config] INFO: No shared secret: Activating
[164] [Step Debug] INFO: Checking for client discovery headers: 'HTTP_X_DEBUG_HOST'.
[164] [Step Debug] INFO: Checking header 'HTTP_X_DEBUG_HOST'.
[164] [Step Debug] WARN: Could not discover client host through HTTP headers, connecting to configured address/port: localhost:9003.
[164] [Step Debug] WARN: Creating socket for 'localhost:9003', poll success, but error: Operation now in progress (29).
[164] [Step Debug] WARN: Creating socket for 'localhost:9003', connect: Cannot assign requested address.
[164] [Step Debug] ERR: Could not connect to debugging client. Tried: localhost:9003 (fallback through xdebug.client_host/xdebug.client_port).
[164] [Config] INFO: Trigger value for 'XDEBUG_TRIGGER' not found, falling back to 'XDEBUG_TRACE'
[164] [Config] INFO: Trigger value for 'XDEBUG_TRACE' not found, so not activating
[164] Log closed at 2022-12-25 23:07:23.224448

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (12 by maintainers)

Commits related to this issue

Most upvoted comments

I have tested this on Ubuntu 22.04 on a PHP 8.1 project:

  • I disabled my workaround.
  • I ran warden env pull && warden env up.
  • I tested if XDebug works again.

Aaaannddd… It works again! Thanks to everyone involved fixing this!

In case it’s useful, the following should be able to be used to gather the gateway IP from within any running container without requiring additional packages:

awk '/32 host/ { if (i !~ /^127\./) print i } { i=$2 }' /proc/net/fib_trie | head -n1 | sed -E 's/\.[0-9]+$/\.1/'

Seemed interesting that this only affects PHP 8.1, but not PHP 7.4, so I took a look through Xdebug update notes and found this:

Fixed bug #1819: Allow a list of headers in ‘xdebug.client_discovery_header’

The last comment on that bug tracker reads:

if someone upgraded to xdebug 3.2 and was using client_discovery_header you have to change it to:

xdebug.client_discovery_header=“YOUR_CURRENT_VALUE,HTTP_X_FORWARDED_FOR,REMOTE_ADDR”

if you want the same behavior

Considering the documentation on the feature hasn’t changed to reflect this, could be a bug. Or it could be a miss on updating docs to reflect the BC break. I’d suggest reporting this issue upstream, as it does seem like an unintended change to me.

Since XDebug 3.2 dropped support for 7.4, the PHP 7.4 images are running XDebug 3.1 or 3.0 and thus unaffected by the behavior change.

On Ubuntu 22.04.1 on a PHP 8.1 M2 project:

> docker inspect <proj>_default | grep Gateway
                    "Gateway": "172.22.0.1"

> docker run -it --rm ubuntu:22.04 bash -c "apt-get update > /dev/null && apt-get install iproute2 -y > /dev/null && ip -4 route show default | cut -d' ' -f3"
debconf: delaying package configuration, since apt-utils is not installed
172.17.0.1

And the respective $_SERVER values:

$_SERVER['HTTP_X_FORWARDED_FOR']: 172.20.0.1, 172.22.0.2
$_SERVER['REMOTE_ADDR']: 172.22.0.14