"Error: couldn't bind tcl to socket on port 6666: Address already in use"...

See original GitHub issue

hey there đź‘‹

i’m running into a new but familiar error using the recently released v0.3.3 update. here are the steps to reproduce:

  1. start a new debugging session
  2. upon completion, click “disconnect”
  3. start another debugging session

expected debugging session starts, i’m able to pause and step around

actual debugging session fails to start, i get a error dialog saying “Failed to launch OpenOCD GDB Server: Timeout”

having run into this from time to time in the past, i know to check the “Adapter Output” within VSCode where i see:

Open On-Chip Debugger 0.10.0+dev-00920-g6ea43726 (2019-09-09-19:42)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "swd". To override use 'transport select <transport>'.
Error: couldn't bind tcl to socket on port 6666: Address already in use

running lsof -i :6666 returns:

COMMAND    PID        USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
_openocd 22018 me    3u  IPv4  64035      0t0  TCP localhost:6666 (LISTEN)
me@ubuntu:~$ 

…which confirms that i have an instance of openocd running still despite having ended the debugging session (via the “disconnect” button in VSCode’s debug toolbar).

if i quit that process (via kill <pid>), i’m able to start a new debugging session in VSCode without error.

i’ve seen this in the past (https://github.com/Marus/cortex-debug/issues/81#issuecomment-449185068 and https://github.com/Marus/cortex-debug/issues/181) though the later case was due to my copy of openocd being weird. whereas in the past this would happen something like once every 10 tries (running cortex-debug@0.3.1), it seems to happen 100% of the time now (running cortex-debug@0.3.3)

i’ve confirmed this behavior on:

  • macOS v10.13.6
  • ubuntu: v18.04.3

here’s the VSCode version info: Version: 1.39.0 Commit: 9df03c6d6ce97c6645c5846f6dfa2a6a7d276515 Date: 2019-10-09T06:58:03.188Z Electron: 4.2.10 Chrome: 69.0.3497.128 Node.js: 10.11.0 V8: 6.9.427.31-electron.0 OS: Linux x64 4.15.0-65-generic

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14

github_iconTop GitHub Comments

1reaction
doozMencommented, Dec 12, 2019

I also had the issue but would like to add that v0.3.3 or any older versions did not fix everything for me as my device was previously configured for mesh. I found a solution after multiple resets. Elaborate info for others can be found particle forum

But what I did was

  1. install backup firmware via dfu (reset halted otherwise)
  2. factory reset
  3. Add code to remove mesh and ble from startup
 #if defined(DEBUG_BUILD)
  Mesh.off();
  BLE.off();
  #endif
  1. manually put in defu mode with buttons, particle debug command halts otherwise
  2. follow tutorial
  3. start degugging session.

this works now. thanks @busticated for all the help

Note that docs of particle mention problems with mesh. But only tutorial mentions that BLE is also a problem.

1reaction
superjaxcommented, Oct 30, 2019

May be related, I was having this same error message and it looks like openocd was not exiting cleanly in my machine. I ran pgrep openocd to find the PID of the still-running process and then killed it. Then I was able to run again.

Any reason why openocd is not getting shut down?

Read more comments on GitHub >

github_iconTop Results From Across the Web

OpenOCD couldn't bind tcl to socket - Stack Overflow
Turns out that this is caused by another process using port 6666 which is used by the tcl server. To find out the...
Read more >
Error: couldn't bind tcl to socket on port 6666: No error
Solved: Started by GNU MCU Eclipse Open On-Chip Debugger 0.11.0+dev-4.3.0.1746 (2021-09-16-07:59) Licensed under GNU GPL v2 For bug reports, ...
Read more >
STM32 Error: couldn't bind tcl to socket on port 6666 - Reddit
Either you have another instance of OpenOCD running (killall openocd if you're on Linux) or some other process on your machine is using...
Read more >
OpenOCD Error: "Error: couldn't bind tcl to socket on port 6666
We do this by running the following: openocd <other options> -c "bindto <ip address>" If the ip address is set to the wrong...
Read more >
Re: [OpenOCD-devel] Error: couldn't bind to socket: Address ...
Re: [OpenOCD-devel] Error: couldn't bind to socket: Address already in use ... solved it. it was another program using port 4444. but i...
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