codelldb icon indicating copy to clipboard operation
codelldb copied to clipboard

codelldb-launch fails to connect

Open bgemmill opened this issue 1 month ago • 12 comments

OS: Ubuntu 24.04.3 LTS from dockerhub VSCode version: 1.106.1 CodeLLDB version: 1.11.8 Compiler: Ubuntu clang version 21.1.6 from llvm apt repository Debuggee: c++ with debug symbols

Up until this morning, CodeLLDB has been working splendidly for my project.

Now, when trying to start a debugging target, it looks like the process is started and runs ok (I see expected output in the debugger console) but codelldb doesn't seem to connect to it.

I tried downgrading CodeLLDB to 1.11.7 but see the same error.

Is there a way to get even more verbose output from the codelldb-launch process?

Verbose log
$  /home/docker/.vscode/extensions/vadimcn.vscode-lldb-1.11.8/bin/codelldb-launch --connect=127.0.0.1:39359 --clear-screen 
Error: Os { code: 111, kind: ConnectionRefused, message: "Connection refused" }
Debug Console
Console is in 'commands' mode, prefix expressions with '?'.
Failed to redirect stdio to a terminal. (Terminal agent did not respond within the allotted time.)
Debuggee output will appear here.
<expected binary output appears here>
Process exited with code 0.

bgemmill avatar Nov 19 '25 19:11 bgemmill

Is there a way to get even more verbose output from the codelldb-launch process?

Not really.

The error is coming from the TCP layer and indicates that there's nobody listening on that port, which is pretty strange, since codelldb sends the port number only after starting listening on that port.

Is this error transient or does it occur always?

vadimcn avatar Nov 19 '25 19:11 vadimcn

As of today it's happening every time I attempted to debug with LLDB; I actually just finished editing launch.json to move everything over to gdb until I can get to the bottom of this.

Since reproduction is pretty easy, is there anything you'd like me to do?

bgemmill avatar Nov 19 '25 19:11 bgemmill

Well, no so easy - I could repro it only if I close all terminal panes in VSCode first.
Looks like there's a ~5 sec delay in launching codelldb-launch in this case. Which happens to be the same timeout that codelldb waits to hear back from it before proceeding.

I can increase the timeout, of course, but the underlying issue seems to be in VSCode.

vadimcn avatar Nov 19 '25 23:11 vadimcn

In fact, this seems to be related to VSCode shell integration: when I disable it, the issue goes away. Can you please confirm? "terminal.integrated.shellIntegration.enabled": false

vadimcn avatar Nov 19 '25 23:11 vadimcn

Thanks for that! If I set that option to false, debugging with lldb appears to work for me as well.

Is this a known incompatibility?

bgemmill avatar Nov 20 '25 15:11 bgemmill

I'm on VSCode version: 1.106.1, CodeLLDB version: 1.11.8 and still have this problem, even with the shell integration disabled.

KucaKun avatar Nov 26 '25 12:11 KucaKun

@KucaKun Does it look like it takes more than 5 seconds to start codelldb-launch after you initiate debugging?

vadimcn avatar Nov 26 '25 17:11 vadimcn

Yes

KucaKun avatar Nov 26 '25 17:11 KucaKun

@KucaKun Any idea why? Does it take this long in general to open a new terminal? Does codelldb-launch fail if you try again when the terminal is already open?

vadimcn avatar Nov 26 '25 17:11 vadimcn

Something changed. I don't really know what's happening. I don't get the OS error anymore. With or without shell integration. (EDIT: it was due to setting lldb.library to a release build of llvm lldblib liblldb: C:\Program Files\LLVM\bin\liblldb.dll)

In the meantime i disabled the windows firewall for your executables on localhost. Maybe this is why the error shows no more? EDIT: the rules do nothing in this error

Breakpoints work, but the output from my program (stdout and err) are nowhere to be found. I tried integrated, and external console. The terminal is empty. EDIT: Also the lldb.library

I tried to redirect stdio and the file got filled with data.

Should I open a new issue?

Debug console log:

Console is in 'commands' mode, prefix expressions with '?'.
Launching: G:\rep\bevvy-rust\target\debug\maze.exe
Launched process 7192 from 'G:\rep\bevvy-rust\target\debug\maze.exe'

Output log:

``` Verbose logging: off (Use "lldb.verboseLogging" setting to change) Platform: win32 x64 Initial debug configuration: { type: 'lldb', request: 'launch', name: 'launch vadimcn', program: '${workspaceRoot}\\target\\debug\\maze.exe', args: [], cwd: '${workspaceFolder}', __configurationTarget: 6 } Resolved debug configuration: { type: 'lldb', request: 'launch', name: 'launch vadimcn', program: 'G:\\rep\\bevvy-rust\\target\\debug\\maze.exe', args: [], cwd: 'G:\\rep\\bevvy-rust', __configurationTarget: 6, terminal: 'integrated', relativePathBase: 'g:\\rep\\bevvy-rust', _adapterSettings: { displayFormat: 'auto', showDisassembly: 'never', dereferencePointers: true, suppressMissingSourceFiles: false, evaluationTimeout: 5, consoleMode: 'commands', sourceLanguages: null, scriptConfig: {}, evaluateForHovers: true, commandCompletions: true } } Launching adapter liblldb: C:\Program Files\LLVM\bin\liblldb.dll environment: {} settings: { evaluateForHovers: true, commandCompletions: true } ```
Verbose log from run without redirection:
``` Verbose logging: on (Use "lldb.verboseLogging" setting to change) Platform: win32 x64 Initial debug configuration: { type: 'lldb', request: 'launch', name: 'launch vadimcn', program: '${workspaceRoot}\\target\\debug\\maze.exe', args: [], cwd: '${workspaceFolder}', preLaunchTask: 'rust: cargo build maze', __configurationTarget: 6 } Resolved debug configuration: { type: 'lldb', request: 'launch', name: 'launch vadimcn', program: 'G:\\rep\\bevvy-rust\\target\\debug\\maze.exe', args: [], cwd: 'G:\\rep\\bevvy-rust', preLaunchTask: 'rust: cargo build maze', __configurationTarget: 6, terminal: 'integrated', relativePathBase: 'g:\\rep\\bevvy-rust', _adapterSettings: { displayFormat: 'auto', showDisassembly: 'never', dereferencePointers: true, suppressMissingSourceFiles: false, evaluationTimeout: 5, consoleMode: 'commands', sourceLanguages: null, scriptConfig: {}, evaluateForHovers: true, commandCompletions: true } } Launching adapter liblldb: C:\Program Files\LLVM\bin\liblldb.dll environment: {} settings: { evaluateForHovers: true, commandCompletions: true } [INFO codelldb] Loaded "C:\\Program Files\\LLVM\\bin\\liblldb.dll", version="lldb version 21.1.6" [DEBUG codelldb] Connecting to 127.0.0.1:56892 [DEBUG codelldb] New debug session [DEBUG codelldb::dap_codec] --> {"command":"initialize","arguments":{"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"lldb","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en","supportsProgressReporting":true,"supportsInvalidatedEvent":true,"supportsMemoryReferences":true,"supportsArgsCanBeInterpretedByShell":true,"supportsMemoryEvent":true,"supportsStartDebuggingRequest":true,"supportsANSIStyling":true},"type":"request","seq":1} [DEBUG codelldb::dap_codec] {"command":"launch","arguments":{"type":"lldb","request":"launch","name":"launch vadimcn","program":"G:\\rep\\bevvy-rust\\target\\debug\\maze.exe","args":[],"cwd":"G:\\rep\\bevvy-rust","preLaunchTask":"rust: cargo build maze","__configurationTarget":6,"terminal":"integrated","relativePathBase":"g:\\rep\\bevvy-rust","_adapterSettings":{"displayFormat":"auto","showDisassembly":"never","dereferencePointers":true,"suppressMissingSourceFiles":false,"evaluationTimeout":5,"consoleMode":"commands","sourceLanguages":null,"scriptConfig":{},"evaluateForHovers":true,"commandCompletions":true},"__sessionId":"9bdcb4c9-62b1-48e2-981b-12f8353c1767"},"type":"request","seq":2} [DEBUG codelldb::dap_codec] {"command":"setFunctionBreakpoints","arguments":{"breakpoints":[]},"type":"request","seq":3} [DEBUG codelldb::dap_codec] --> {"command":"setInstructionBreakpoints","arguments":{"breakpoints":[]},"type":"request","seq":4} [DEBUG codelldb::dap_codec] {"command":"setExceptionBreakpoints","arguments":{"filters":[],"filterOptions":[{"filterId":"cpp_throw"}]},"type":"request","seq":5} [DEBUG codelldb::dap_codec] {"command":"setDataBreakpoints","arguments":{"breakpoints":[]},"type":"request","seq":6} [DEBUG codelldb::dap_codec] {"command":"configurationDone","type":"request","seq":7} [DEBUG codelldb::dap_codec] {"type":"response","seq":8,"command":"runInTerminal","request_seq":8,"success":true,"body":{"shellProcessId":6796}} [DEBUG codelldb::debug_session::launch] launch env: ["DriverData=C:\\Windows\\System32\\Drivers\\DriverData", "ChocolateyLastPathUpdate=133879138608774236", "APPLICATIONINSIGHTS_CONFIGURATION_CONTENT={}", "OneDrive=C:\\Users\\Kuca\\OneDrive", "USERDOMAIN_ROAMINGPROFILE=DESKTOP-9R7NCE6", "PROCESSOR_LEVEL=6", "VSCODE_NLS_CONFIG={\"userLocale\":\"en\",\"osLocale\":\"pl\",\"resolvedLanguage\":\"en\",\"defaultMessagesFile\":\"C:\\\\Users\\\\Kuca\\\\AppData\\\\Local\\\\Programs\\\\Microsoft VS Code\\\\resources\\\\app\\\\out\\\\nls.messages.json\",\"locale\":\"en\",\"availableLanguages\":{}}", "PROCESSOR_REVISION=a505", "ProgramData=C:\\ProgramData", "VSCODE_ESM_ENTRYPOINT=vs/workbench/api/node/extensionHostProcess", "HOMEDRIVE=C:", "ComSpec=C:\\WINDOWS\\system32\\cmd.exe", "HOMEPATH=\\Users\\Kuca", "APPDATA=C:\\Users\\Kuca\\AppData\\Roaming", "USERNAME=Kuca", "CommonProgramFiles(x86)=C:\\Program Files (x86)\\Common Files", "ALLUSERSPROFILE=C:\\ProgramData", "VSCODE_CWD=C:\\Users\\Kuca\\AppData\\Local\\Programs\\Microsoft VS Code", "SystemRoot=C:\\WINDOWS", "ProgramFiles(x86)=C:\\Program Files (x86)", "ELECTRON_RUN_AS_NODE=1", "OS=Windows_NT", "CommonProgramFiles=C:\\Program Files\\Common Files", "ChocolateyInstall=C:\\ProgramData\\chocolatey", "LOCALAPPDATA=C:\\Users\\Kuca\\AppData\\Local", "RUST_TRACEBACK=1", "SystemDrive=C:", "Path=C:\\Python313\\Scripts\\;C:\\Python313\\;C:\\Program Files\\Common Files\\Oracle\\Java\\javapath;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C:\\Users\\Kuca\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\\LocalCache\\local-packages\\Scripts\\;D:\\Git\\bin\\;C:\\ProgramData\\chocolatey\\bin;C:\\Users\\Kuca\\AppData\\Local\\Programs\\Python\\Python310;C:\\Program Files\\LLVM\\bin;C:\\Users\\Kuca\\.local\\bin;C:\\Users\\Kuca\\.cargo\\bin;C:\\Users\\Kuca\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\Kuca\\AppData\\Local\\Programs\\Ollama;C:\\Users\\Kuca\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;c:\\users\\kuca\\appdata\\local\\packages\\pythonsoftwarefoundation.python.3.13_qbz5n2kfra8p0\\localcache\\local-packages\\scripts;C:\\Users\\Kuca\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\\LocalCache\\local-packages\\Scripts\\;D:\\Git\\bin\\;", "LOGONSERVER=\\\\DESKTOP-9R7NCE6", "RUST_LOG=error,codelldb=debug", "COMPUTERNAME=DESKTOP-9R7NCE6", "PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 165 Stepping 5, GenuineIntel", "APPLICATION_INSIGHTS_NO_STATSBEAT=true", "PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.PYW", "ProgramW6432=C:\\Program Files", "USERDOMAIN=DESKTOP-9R7NCE6", "PROCESSOR_ARCHITECTURE=AMD64", "VSCODE_PID=17852", "CommonProgramW6432=C:\\Program Files\\Common Files", "ProgramFiles=C:\\Program Files", "VSCODE_IPC_HOOK=\\\\.\\pipe\\2a2f3471-1.106.3-main-sock", "PUBLIC=C:\\Users\\Public", "APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL=1", "NUMBER_OF_PROCESSORS=16", "VSCODE_CODE_CACHE_PATH=C:\\Users\\Kuca\\AppData\\Roaming\\Code\\CachedData\\bf9252a2fb45be6893dd8870c0bf37e2e1766d61", "SESSIONNAME=Console", "ORIGINAL_XDG_CURRENT_DESKTOP=undefined", "VSCODE_L10N_BUNDLE_LOCATION=", "EFC_7916_1592913036=1", "windir=C:\\WINDOWS", "PSModulePath=C:\\Program Files\\WindowsPowerShell\\Modules;C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules;C:\\Program Files\\Intel\\Wired Networking\\", "VSCODE_CRASH_REPORTER_PROCESS_TYPE=extensionHost", "TEMP=C:\\Users\\Kuca\\AppData\\Local\\Temp", "VSCODE_HANDLES_UNCAUGHT_ERRORS=true", "USERPROFILE=C:\\Users\\Kuca", "CHROME_CRASHPAD_PIPE_NAME=\\\\.\\pipe\\crashpad_17852_AEBDUOALDTJGCRDJ", "TMP=C:\\Users\\Kuca\\AppData\\Local\\Temp"] [DEBUG codelldb::dap_codec] {"command":"threads","type":"request","seq":9} [DEBUG codelldb::debug_session] Debug event: 000001B0B22E4A20 Event: broadcaster = 000001B0FD1070A8 (lldb.target), type = 0x00000002 (modules-loaded), data = {vulkan-1.dll} [DEBUG codelldb::debug_session] Debug event: 000001B0B22E4AD0 Event: broadcaster = 000001B0FD1070A8 (lldb.target), type = 0x00000002 (modules-loaded), data = {vulkan-1.dll} [DEBUG codelldb::dap_codec]

KucaKun avatar Nov 29 '25 19:11 KucaKun

In the meantime i disabled the windows firewall for your executables on localhost. Maybe this is why the error shows no more?

Could be, though usually the Windows firewall does not interfere with local connections.
The log shows that CodeLLDB was able to spawn the terminal agent successfully and redirected the debuggee output to that terminal without any reported errors.

Should I open a new issue?

Maybe. However, since I don't know how to reproduce this problem, it won't be of much use, unless you are prepared to do some investigation of your end. Can you think of anything that is different about your machine compared to a vanilla Windows setup?

BTW, when reporting issues, it is always helpful to call out the OS being used. I had no idea you are on Windows - the original report was for Linux.

vadimcn avatar Nov 29 '25 21:11 vadimcn

Yes, sorry for no OS specified.

As for the reproduction I'll try someday to install a fresh vscode without any unnecessary extensions.

I did notice in the log, that it uses some LLVM dll installed on my machine, and not the one you supply in your extension. Worth investigating?

Launching adapter
liblldb: C:\Program Files\LLVM\bin\liblldb.dll

KucaKun avatar Nov 29 '25 21:11 KucaKun