mirrord: [Mac OS][xdebug] Can't debug with xdebug while running mirrord inside Docker container
Bug Description
Mac OS + running Docker image with mirrord inside + PHP + xdebug
Mac OS Sonoma 14.5 (23F79)
mirrord 3.108.0
Docker version 26.1.4, build 5650f9b
this is from the Docker image cli:
root@1874070f34e2:/var/www# php -v
PHP 8.3.8 (cli) (built: Jun 13 2024 05:41:23) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.8, Copyright (c) Zend Technologies
with Zend OPcache v8.3.8, Copyright (c), by Zend Technologies
with Xdebug v3.3.2, Copyright (c) 2002-2024, by Derick Rethans
with ddtrace v1.1.0, Copyright Datadog, by Datadog
Steps to Reproduce
Dockerfile - this is a PHP app, image also installs mirrord
mirrord.json
{
"agent":
{
"ephemeral": true
},
"feature":
{
"network":
{
"incoming":
{
"ignore_localhost": true
},
"outgoing":
{
"ignore_localhost": true,
"filter":
{
"local":
[
":9000",
":9003"
]
}
}
}
}
}
mirrord exec -t deployment/mypod -n serbanghita-core --context cluster-dev --no-telemetry --steal -f /mirrord.json -- start.sh
the log contains these errors
2024-07-08T09:21:23.567154Z ERROR ThreadId(01) mirrord_layer::error: Error occured in Layer >> IO(Custom { kind: Uncategorized, error: "failed to lookup address information: Name or service not known" })
When I request an URL and inject XDEBUG_SESSION_START, I can see traffic but the debugger doesn’t work.
Enabling logs:
[171] [Step Debug] INFO: Connecting to configured address/port: 192.168.65.254:9003.
[171] [Step Debug] WARN: Creating socket for '192.168.65.254:9003', connect: Input/output error.
[171] [Step Debug] ERR: Could not connect to debugging client. Tried: 192.168.65.254:9003 (through xdebug.client_host/xdebug.client_port).
[171] Log closed at 2024-07-08 08:31:25.652814
Backtrace
No response
Relevant Logs
No response
Your operating system and version
Mac OS
Local process
docker
Local process version
No response
Additional Info
Once the container is up, I also tried from within the Docker container:
root@583a04f8ada1:/var/www# mirrord exec -t deployment/mypod -n serbanghita-core --context cluster-dev --no-telemetry --steal -f /mirrord.json -- telnet 192.168.65.254 9003
throws
Trying 192.168.65.254...
2024-07-08T07:53:59.713728Z ERROR ThreadId(01) mirrord_layer::error: Error occured in Layer >> IO(Custom { kind: Uncategorized, error: "failed to lookup address information: Name or service not known" })
telnet: Unable to connect to remote host: Input/output error
but when I changed dns: false in mirrord.json
Trying 192.168.65.254...
Connected to 192.168.65.254.
Escape character is '^]'.
xdebug info
root@1874070f34e2:/var/www# php -r "xdebug_info();"
__ __ _ _
\ \ / / | | | |
\ V / __| | ___| |__ _ _ __ _
> < / _` |/ _ \ '_ \| | | |/ _` |
/ . \ (_| | __/ |_) | |_| | (_| |
/_/ \_\__,_|\___|_.__/ \__,_|\__, |
__/ |
|___/
Version => 3.3.2
Support Xdebug on Patreon, GitHub, or as a business: https://xdebug.org/support
Enabled Features (through 'xdebug.mode' setting)
Feature => Enabled/Disabled
Development Helpers => ✘ disabled
Coverage => ✘ disabled
GC Stats => ✘ disabled
Profiler => ✘ disabled
Step Debugger => ✔ enabled
Tracing => ✘ disabled
Optional Features
Compressed File Support => no
Clock Source => clock_gettime
'xdebug://gateway' pseudo-host support => yes
'xdebug://nameserver' pseudo-host support => yes
Systemd Private Temp Directory => not enabled
Diagnostic Log
No messages
Step Debugging
Debugger is active
Connected Client => 192.168.65.254:9003
DBGp Settings
Max Children => 100
Max Data => 1024
Max Depth => 1
Show Hidden Properties => Yes
Extended Properties => Yes
Notifications => Yes
Resolved Breakpoints => Yes
Breakpoint: Details => No
Breakpoint: Include Return Values => Yes
PHP
Build Configuration
Version (Run Time) => 8.3.8
Version (Compile Time) => 8.3.8
Debug Build => no
Thread Safety => disabled
Settings
Configuration File (php.ini) Path => /usr/local/etc/php
Loaded Configuration File => /usr/local/etc/php/php.ini
Scan this dir for additional .ini files => /usr/local/etc/php/conf.d
Additional .ini files parsed => /usr/local/etc/php/conf.d/98-ddtrace.ini,
/usr/local/etc/php/conf.d/99-ddtrace-custom.ini,
/usr/local/etc/php/conf.d/docker-fpm.ini,
/usr/local/etc/php/conf.d/docker-php-ext-bcmath.ini,
/usr/local/etc/php/conf.d/docker-php-ext-calendar.ini,
/usr/local/etc/php/conf.d/docker-php-ext-ftp.ini,
/usr/local/etc/php/conf.d/docker-php-ext-gd.ini,
/usr/local/etc/php/conf.d/docker-php-ext-gettext.ini,
/usr/local/etc/php/conf.d/docker-php-ext-gmp.ini,
/usr/local/etc/php/conf.d/docker-php-ext-imagick.ini,
/usr/local/etc/php/conf.d/docker-php-ext-imap.ini,
/usr/local/etc/php/conf.d/docker-php-ext-intl.ini,
/usr/local/etc/php/conf.d/docker-php-ext-opcache.ini,
/usr/local/etc/php/conf.d/docker-php-ext-pcntl.ini,
/usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini,
/usr/local/etc/php/conf.d/docker-php-ext-pdo_pgsql.ini,
/usr/local/etc/php/conf.d/docker-php-ext-rdkafka.ini,
/usr/local/etc/php/conf.d/docker-php-ext-redis.ini,
/usr/local/etc/php/conf.d/docker-php-ext-soap.ini,
/usr/local/etc/php/conf.d/docker-php-ext-sockets.ini,
/usr/local/etc/php/conf.d/docker-php-ext-sodium.ini,
/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini,
/usr/local/etc/php/conf.d/docker-php-ext-zip.ini,
/usr/local/etc/php/conf.d/ext-xdebug.ini
Directive => Local Value => Master Value
xdebug.mode => debug => debug
xdebug.start_with_request => yes => yes
xdebug.start_upon_error => default => default
xdebug.output_dir => /tmp => /tmp
xdebug.use_compression => 0 => 0
xdebug.trigger_value => no value => no value
xdebug.file_link_format => no value => no value
xdebug.filename_format => no value => no value
xdebug.control_socket => time: 25ms => time: 25ms
xdebug.log => /tmp/xdebug.log => /tmp/xdebug.log
xdebug.log_level => 10 => 10
xdebug.var_display_max_children => -1 => -1
xdebug.var_display_max_data => -1 => -1
xdebug.var_display_max_depth => -1 => -1
xdebug.max_nesting_level => 512 => 512
xdebug.cli_color => 0 => 0
xdebug.force_display_errors => Off => Off
xdebug.force_error_reporting => 0 => 0
xdebug.halt_level => 0 => 0
xdebug.max_stack_frames => -1 => -1
xdebug.show_error_trace => Off => Off
xdebug.show_exception_trace => Off => Off
xdebug.show_local_vars => Off => Off
xdebug.dump.COOKIE => no value => no value
xdebug.dump.ENV => no value => no value
xdebug.dump.FILES => no value => no value
xdebug.dump.GET => no value => no value
xdebug.dump.POST => no value => no value
xdebug.dump.REQUEST => no value => no value
xdebug.dump.SERVER => no value => no value
xdebug.dump.SESSION => no value => no value
xdebug.dump_globals => On => On
xdebug.dump_once => On => On
xdebug.dump_undefined => Off => Off
xdebug.profiler_output_name => cachegrind.out.%p => cachegrind.out.%p
xdebug.profiler_append => Off => Off
xdebug.cloud_id => no value => no value
xdebug.client_host => 192.168.65.254 => 192.168.65.254
xdebug.client_port => 9003 => 9003
xdebug.discover_client_host => Off => Off
xdebug.client_discovery_header => HTTP_X_FORWARDED_FOR,REMOTE_ADDR => HTTP_X_FORWARDED_FOR,REMOTE_ADDR
xdebug.idekey => core.localhost => core.localhost
xdebug.connect_timeout_ms => 200 => 200
xdebug.scream => On => On
xdebug.gc_stats_output_name => gcstats.%p => gcstats.%p
xdebug.trace_output_name => trace.%c => trace.%c
xdebug.trace_format => 0 => 0
xdebug.trace_options => 0 => 0
xdebug.collect_assignments => Off => Off
xdebug.collect_params => On => On
xdebug.collect_return => Off => Off
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 16 (8 by maintainers)
Hey @serbanghita @aghajani We’ve just release version 3.111.0, now you can use the new DNS filter configuration ^^
@aghajani Cool, happy it works for you! The solution I implemented is a bit hacky though and has possible bad interactions with other mirrord features. We plan to solve your problem in a bit different way, one that is more configurable - by adding a local/remote filter to the
feature.network.dns config. I opened an issue to track it here. I suspect we’ll be able to release it in a couple days ^^With the new extended config, you’ll be able to achieve the same result by changing your mirrord config like this:
@serbanghita I prepared a custom version of mirrord CLI that hopefully resolves your problem. You can download it from the artifacts here. I’d appreciate if you could try it out and share feedback ^^ For the fix to work, your mirrord config must contain an outgoing local filter matching the address with no protocol specified (the config linked in issue description works)