View Issue Details

IDProjectCategoryView StatusLast Update
0002017XdebugStep Debuggingpublic2021-09-16 10:58
ReporterErnestophel Assigned Toderick  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionno change required 
Platformmini-pcOSkubuntuOS Version 2104
Product Version3.0.4 
Target Version3.1dev 
Summary0002017: broken pipe, no debug on vscode, devilbox
Description

Running apache webserver under a devilbox under my Linux OS. PHP 7.4 and xdebug 3.04 working under the devilbox. Webpage is shown in Browser.
Configured debug extension for VSCODE, working fine with build in liveserver using xdebug as configured under php under my OS.
Error when trying to debug (option: listen to xdebug) using the devilbox xdebug. xdebug.log showing this:

[1688] Log opened at 2021-09-15 18:15:24.100355
[1688] [Step Debug] INFO: Connecting to configured address/port: localhost:9000.
[1688] [Step Debug] INFO: Connected to debugging client: localhost:9000 (through xdebug.client_host/xdebug.client_port). :-)
[1688] [Step Debug] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug&quot; fileuri="file:///var/www/default/htdocs/index.php" language="PHP" xdebug:language_version="7.4.20" protocol_version="1.0" appid="1688" idekey="VSCODE"><engine version="3.0.4"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]>&lt;/url>&lt;copyright>&lt;![CDATA[Copyright (c) 2002-2021 by Derick Rethans]]></copyright></init>

[1688] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug&quot; status="stopping" reason="ok"></response>

[1688] [Step Debug] WARN: 2021-09-15 18:15:24.456809: There was a problem sending 179 bytes on socket 8: Broken pipe.
[1688] Log closed at 2021-09-15 18:15:24.457012

Steps To Reproduce

Start devilbox (httpd php mysql); Start vhost in webbrowser, webpage opens up. In VSCODE open the corresponding index.php (in the document root folder). Press F5 to start debugging. Debugging toolbar shows only buttons for stop and restart. xdebug.log is written (please, see above).

TagsNo tags attached.
Operating SystemKubuntu
PHP Version7.4.0-7.4.4

Activities

Ernestophel

2021-09-15 20:21

reporter   ~0006006

docker-compose.yml of devilbox has PHP_FPM_SERVER_PORT=9000 entry. I assume that with xdebug 3 this port has to be changed to 9003. Trying to override the yml leads to a temporaily unavailable server problem.

derick

2021-09-16 08:51

administrator   ~0006008

This does not look like a bug, but rather a conflict between ports. PHP_FPM should stay on port 9000, and Xdebug and the VS Code plugin need to be configured with port 9003. That is the default for Xdebug 3, but some older versions of the VS Code plugin still have it as 9000 - you need to change that to 9003. The PHP-FPM port and Xdebug/VS Code plugin code can not be the same.

Ernestophel

2021-09-16 09:25

reporter   ~0006009

Thanks a lot, derik. Tried this out but still not working:

[1685] Log opened at 2021-09-16 09:13:50.362560
[1685] [Step Debug] INFO: Connecting to configured address/port: localhost:9003.
[1685] [Step Debug] WARN: Creating socket for 'localhost:9003', poll success, but error: Operation now in progress (29).
[1685] [Step Debug] WARN: Creating socket for 'localhost:9003', connect: Cannot assign requested address.
[1685] [Step Debug] ERR: Could not connect to debugging client. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port) :-(
[1685] Log closed at 2021-09-16 09:13:50.364248

My settings (php.ini devilbox):
[PHP]
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.remote_handler = dbgp
xdebug.client_port = 9003
xdebug.idekey = VSCODE
xdebug.remote_log = /contao/web/xdebug.remote.log # not working!
xdebug.log_level = 10
; xdebug.start_with_request = yes
xdebug.remote_connect_back = On
; ; xdebug.discover_client_host = 1 # not recognized, 2 differnet networks (devilbox / VSCODE = HOST-OS)
; zend_extension = xdebug # unneccessary
xdebug.log = /shared/httpd/contao/web/xdebug.log

launch.json of vscode:
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003,
// "pathMappings": {
// "/shared/httpd/contao/web": "${workspaceFolder}/projects/contao/web"
// },
"log": true,
"stopOnEntry": true
},
...

.env of devilbox:
HTTPD_DOCROOT_DIR=web
HOST_PATH_HTTPD_DATADIR=/home/ernst/webdev/projects

My project:
contao/
document root: contao/web/

Ernestophel

2021-09-16 09:28

reporter   ~0006010

sorry, launch.json new:

"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003,
"pathMappings": {
"/shared/httpd/contao/web": "${workspaceFolder}/projects/contao/web"
},
"log": true,
"stopOnEntry": true
},

Ernestophel

2021-09-16 09:49

reporter   ~0006012

phpinfo() leads to this help paragraph:

DBG-E-NOCON
Occurs when Xdebug is trying to connect to a debuging client to start a debugging session.

The debugger could not make a connection to the client. The error message indicates which host and port combinations were tried, and through which configuration options it came to that conclusion.

An example:

Could not connect to debugging client. Tried: ::1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port)

This message indicates that Xdebug first tried to use ::1:9003 (IPv6's localhost) from the REMOTE_ADDR header, and then it fell back to localhost:9003 as configured with xdebug.client_host and xdebug.client_port.

Suggested solutions:

*Check whether your debugging client is listening on the indicated address and port. On Linux and OSX, you can use netstat -a -n | grep LISTEN to check. -> listening to .9003
Change xdebug.client_host and/or xdebug.client_port to the right address/hostname and port of where the debugging client is listening. -> this option is not available in php.ini...**

Maybe I should try instead "xdebugSettings": {} in luanch.json of vscode? if so, which is the appropriate entry to set?

Ernestophel

2021-09-16 09:53

reporter   ~0006013

But "xdebugSettings":{} would not make much sense, as it is xdebug trying to connect to my OS (vscode), so the correct address should be set on the server side, I assume. But how and where?

derick

2021-09-16 10:14

administrator   ~0006014

But "xdebugSettings":{} would not make much sense,

That's right, VS Code does need the settings you've shown earlier.

so the correct address should be set on the server side, I assume. But how and where?

Yes, it needs to be set on the server side. It's xdebug.client_host (https://xdebug.org/docs/step_debug#client_host)

A few comments about some of your settings:

xdebug.remote_handler = dbgp

Has been removed in Xdebug 3: https://xdebug.org/docs/upgrade_guide#removed-xdebug.remote_handler

xdebug.remote_log = /contao/web/xdebug.remote.log # not working!

That's correct, it has been replace by xdebug.log: https://xdebug.org/docs/upgrade_guide#changed-xdebug.remote_log

xdebug.remote_connect_back = On

Has been replaced by xdebug.discover_client_host: https://xdebug.org/docs/upgrade_guide#changed-xdebug.remote_connect_back

it would be good if you read the rest of the upgrade guide too: https://xdebug.org/docs/upgrade_guide

Ernestophel

2021-09-16 10:30

reporter   ~0006015

xdebug.client_host=172.16.238.1

I tried this in my xdebug.ini on devilbox, and its working!! Typing "xdebug." does not show me this option, maybe a mistake in intellisense or whatever is there in the background? Thats why I did not try this before.

Not sure why to take just this address anf if this address will be always the same?

Ernestophel

2021-09-16 10:46

reporter   ~0006016

Obviously there is no intellisense behind .ini files, just simple word completion for words I used before under vscode. Thats been my fault.

I found in the devilbox documenteation:
"If you run Docker on Linux the host IP is always 172.16.238.1, which is the default gateway IP address within the Devilbox bridge network"

So i am fine now, thanks a lot, derick!!!!!

(There is so much info on the web, and its hard to separate the useful from the rest. Asking here is definetely a good idea)

derick

2021-09-16 10:58

administrator   ~0006017

Normally, docker containers will change the IP address, but it does not seem that this is the case with devilbox. Instead of setting the IP address, you should also be able to use xdebug.client_host=docker.for.lin.localhost, in the case that devilbox ever changes it default configuration.

As this is not a bug, I will be closing this report.

Issue History

Date Modified Username Field Change
2021-09-15 18:36 Ernestophel New Issue
2021-09-15 20:21 Ernestophel Note Added: 0006006
2021-09-16 08:51 derick Status new => feedback
2021-09-16 08:51 derick Target Version => 3.1dev
2021-09-16 08:51 derick Note Added: 0006008
2021-09-16 09:25 Ernestophel Note Added: 0006009
2021-09-16 09:25 Ernestophel Status feedback => new
2021-09-16 09:28 Ernestophel Note Added: 0006010
2021-09-16 09:49 Ernestophel Note Added: 0006012
2021-09-16 09:53 Ernestophel Note Added: 0006013
2021-09-16 10:14 derick Note Added: 0006014
2021-09-16 10:30 Ernestophel Note Added: 0006015
2021-09-16 10:46 Ernestophel Note Added: 0006016
2021-09-16 10:58 derick Assigned To => derick
2021-09-16 10:58 derick Status new => closed
2021-09-16 10:58 derick Resolution open => no change required
2021-09-16 10:58 derick Note Added: 0006017