Error: listen EADDRINUSE: address already in use :::9003

See original GitHub issue

PHP version: 7.4 Xdebug version: 3.1.4 VS Code extension version: v1.26.1

Your launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for Xdebug",
            "type": "php",
            "request": "launch",
            "port": 9003,
            "pathMappings": {
                "/var/www/html" : "${workspaceFolder}/www"
            }
        }
    ]
}

Xdebug php.ini config:

zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20190902/xdebug.so
xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.client_host=host.docker.internal
xdebug.client_port=9003
xdebug.idekey=VSCODE

Xdebug logfile (from setting xdebug.log in php.ini):

VS Code extension logfile (from setting "log": true in launch.json):

Error: listen EADDRINUSE: address already in use :::9003
    at Server.setupListenHandle [as _listen2] (node:net:1334:16)
    at listenInCluster (node:net:1382:12)
    at Server.listen (node:net:1469:7)
    at /home/fabricio/.vscode/extensions/xdebug.php-debug-1.26.1/out/phpDebug.js:375:24
    at new Promise (<anonymous>)
    at createServer (/home/fabricio/.vscode/extensions/xdebug.php-debug-1.26.1/out/phpDebug.js:234:36)
    at PhpDebugSession.launchRequest (/home/fabricio/.vscode/extensions/xdebug.php-debug-1.26.1/out/phpDebug.js:390:30)
    at PhpDebugSession.dispatchRequest (/home/fabricio/.vscode/extensions/xdebug.php-debug-1.26.1/node_modules/vscode-debugadapter/lib/debugSession.js:378:22)
    at PhpDebugSession.dispatchRequest (/home/fabricio/.vscode/extensions/xdebug.php-debug-1.26.1/out/phpDebug.js:489:15)
    at PhpDebugSession.handleMessage (/home/fabricio/.vscode/extensions/xdebug.php-debug-1.26.1/node_modules/vscode-debugadapter/lib/protocol.js:61:18) {
  code: 'EADDRINUSE',
  errno: -98,
  syscall: 'listen',
  address: '::',
  port: 9003
}

There are no services using ports 9003, but the error persists.

My OS info scan report nmap

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
zobocommented, Apr 28, 2022

Just remove the whole line (under port in docker-compose). You do not need to forward TCP 9003 to your docker. The php+xdebug process inside your docker connects to your IDE that listens on 9003. Thats what xdebug.client_host tells php.

0reactions
zobocommented, Apr 29, 2022

My pleasure. Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Node / Express: EADDRINUSE, Address already in use - Kill ...
First, you would want to know which process is using port 3000 sudo lsof -i :3000. this will list all PID listening on...
Read more >
How to kill server when seeing “EADDRINUSE: address ...
When this EADDRINUSE issue has already happened, in order to resolve it, you need to kill the process manually. In order to do...
Read more >
Error: listen EADDRINUSE: address already in use :::3000 #568
This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with --detectOpenHandles to ...
Read more >
How to find and terminate a Windows Processes by Port
Learn how to locate the Windows Process occupying a specific port and terminate it when you get an "error listen eaddrinuse: address already...
Read more >
listen EADDRINUSE: address already in use :::9000
How can I switch the bug icon button to use a different port? The JSON below shows some of my attempts. { "name":...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found