Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugger Gets Stuck When Trying to Debug Rust Inside a Dev Container #1063

Open
mcmah309 opened this issue Jan 27, 2024 · 7 comments
Open

Debugger Gets Stuck When Trying to Debug Rust Inside a Dev Container #1063

mcmah309 opened this issue Jan 27, 2024 · 7 comments

Comments

@mcmah309
Copy link

The debugger gets stuck when trying to debug rust container inside a dev container. Here's an example, it stays like this forever

2024-01-26.19-46-20.mp4

.devcontainer

{
	"name": "rust_dev",
	"image": "rust_dev",
	"customizations": {
		"vscode": {
			"extensions": [
				"rust-lang.rust-analyzer",
				"serayuzgur.crates",
				"vadimcn.vscode-lldb"
			]
		}
	},
	"mounts": [
		// rust
		"source=/home/henry/.local/share/containers/storage/volumes/rust_dev/_data/root/.cargo,target=/root/.cargo,type=bind",
		"source=/home/henry/.local/share/containers/storage/volumes/rust_dev/_data/root/.rustup,target=/root/.rustup,type=bind"
	],
	"runArgs": [
		"--net=host",
	],
	"remoteUser": "root"
}

Compiling with cargo and running with vscode works fine.

The output that is notable is this

Warning: codelldb.cargo tasks are unavailable in the current environment.

Warning: codelldb.cargo tasks are unavailable in the current environment.

VSCode version: 1.85.1
Commit: 0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2
Date: 2023-12-13T09:47:11.635Z
Electron: 25.9.7
ElectronBuildId: 25551756
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Linux x64 6.5.13

CodeLLDB version: v1.10.0
Compiler: rustc
Target: stable-x86_64-unknown-linux-musl

log

   Compiling surrealdb_migrations v0.1.0 (/workspaces/surrealdb_migrations)
    Finished test [unoptimized + debuginfo] target(s) in 0.26s
Launching debug configuration:
{
  "type": "lldb",
  "request": "launch",
  "name": "run mod",
  "program": "${workspaceFolder}/target/debug/deps/mod-ebdd3fb29dbc1e23",
  "args": [],
  "cwd": "${workspaceFolder}",
  "sourceMap": {},
  "sourceLanguages": [
    "rust"
  ],
  "env": {
    "RUST_BACKTRACE": "short",
    "SHLVL": "2",
    "HOME": "/root",
    "container": "podman",
    "PATH": "/vscode/vscode-server/bin/linux-alpine/0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2/bin/remote-cli:/root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
    "VSCODE_AGENT_FOLDER": "/root/.vscode-server",
    "SHELL": "/bin/ash",
    "PWD": "/vscode/vscode-server/bin/linux-alpine/0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2",
    "VSCODE_HANDLES_SIGPIPE": "true",
    "VSCODE_AMD_ENTRYPOINT": "vs/workbench/api/node/extensionHostProcess",
    "VSCODE_HANDLES_UNCAUGHT_ERRORS": "true",
    "VSCODE_NLS_CONFIG": "{\"locale\":\"en\",\"osLocale\":\"en\",\"availableLanguages\":{}}",
    "PAGER": "less",
    "REMOTE_CONTAINERS_IPC": "/tmp/vscode-remote-containers-ipc-0a4f2bfb-8a00-41d2-baa0-4712d4583698.sock",
    "LC_COLLATE": "C",
    "REMOTE_CONTAINERS_SOCKETS": "[\"/tmp/vscode-ssh-auth-0a4f2bfb-8a00-41d2-baa0-4712d4583698.sock\",\"/tmp/.X11-unix/X9\"]",
    "LANG": "C.UTF-8",
    "CHARSET": "UTF-8",
    "SSH_AUTH_SOCK": "/tmp/vscode-ssh-auth-0a4f2bfb-8a00-41d2-baa0-4712d4583698.sock",
    "DISPLAY": ":9",
    "REMOTE_CONTAINERS_DISPLAY_SOCK": "/tmp/.X11-unix/X9",
    "REMOTE_CONTAINERS": "true",
    "BROWSER": "/vscode/vscode-server/bin/linux-alpine/0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2/bin/helpers/browser.sh",
    "VSCODE_CWD": "/vscode/vscode-server/bin/linux-alpine/0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2",
    "ELECTRON_RUN_AS_NODE": "1",
    "VSCODE_IPC_HOOK_CLI": "/tmp/vscode-ipc-f23cff8d-2135-498e-bee0-ca04ae85d761.sock",
    "VSCODE_L10N_BUNDLE_LOCATION": ""
  }
}
@mcmah309
Copy link
Author

I was able to fix this issue by using another rust image. It would be nice if Warning: codelldb.cargo tasks are unavailable in the current environment. was more specific and didn't cause vscode to hang indefinitely without being able to be cancelled.

@chris-the-wiz
Copy link

Same problem here. Docker image built from alpine:3.18 . Rust version 1.77.2 installed with rustup 1.27.0

@1414C
Copy link

1414C commented Apr 26, 2024

Same issue:
MacOS Sonoma 14.2.1
rustup 1.27.0 (bbb9276d2 2024-03-08)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active rustc version is rustc 1.77.2 (25ef9e3d8 2024-04-09)
rust-analyzer: v0.3.1932
CodeLLDB: v1.10.0

@kwmartin
Copy link

I have the same issue. Ubuntu 22.04.5 LTS. Installed rust, rust analyzer, and codelldb. Didn't work. Uninstalled every thing and reinstalled. Trying to run the simplest getting started program:

fn main() {
    let stdout = stdout();
    let out = b"Hello fellow Rustaceans!";
    let width = 24;

    let mut writer = BufWriter::new(stdout.lock());
    say(out, width, &mut writer).unwrap();
}

Same error, console output:

fn main() {
    let stdout = stdout();
    let out = b"Hello fellow Rustaceans!";
    let width = 24;

    let mut writer = BufWriter::new(stdout.lock());
    say(out, width, &mut writer).unwrap();
}
Warning: codelldb.cargo tasks are unavailable in the current environment.

I have no idea what error means or how to go about fixing it. Very frustrating when the very first simplest step doesn't work and no guidance to fix. I have googled extensively and can find almost nothing that addresses issue. Thank you for suggestions.

@AlBel157
Copy link

I don't know what is the reason behind, but It was fixed after I created new container (non-alpina)
How to create: https://dev.to/s1ntaxe770r/how-to-setup-ssh-within-a-docker-container-i5i
How to setup VS code: https://code.visualstudio.com/docs/remote/ssh
How to setup rust: https://code.visualstudio.com/docs/languages/rust

@LennyLip
Copy link

Same getting stuck on rust:alpine3.21 docker, looks like it needs some additional software.
rust:latest, based on debian works ok.

@gastrodon
Copy link

gastrodon commented Mar 5, 2025

I'm also having this issue, though occasionally if I wait a very long time ( >10 minutes ) it works? I was still getting the codelldb.cargo tasks are unavailable in the current environment message, though.

Curiously, I wasn't having this issue earlier today, but now I am after not having updated any packages on my system or any vscode extensions. Using lldb extension version 1.11.4, and I am not using it inside of a dev container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants