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

Rust: OS can't spawn a new worker thread #674

Closed
meskill opened this issue Mar 19, 2022 · 9 comments
Closed

Rust: OS can't spawn a new worker thread #674

meskill opened this issue Mar 19, 2022 · 9 comments
Labels
cause:Unclear The cause of the issue is unclear and/or I was not able to reproduce it. waiting for info Waiting for the issue author to provide more information.

Comments

@meskill
Copy link

meskill commented Mar 19, 2022

OS: Windows 10 + WSL 2 + Docker + Alpine Linux (with glibc support)
VSCode version: 1.65.2
CodeLLDB version: 1.7.0
Compiler: rustc
Debuggee: just ordinary binary crate

On debugger run I get a panic thread '<unnamed>' panicked at 'OS can't spawn a new worker thread: Os { code: 1, kind: PermissionDenied, message: "Operation not permitted" }', /opt/rust/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.16.1/src/runtime/blocking/pool. Inside the container there is no such directory as /opt/rust

Verbose log
Running `cargo build --bin=experiments --package=experiments --message-format=json`...
warning: field is never read: `b`
 --> experiments/src/main.rs:4:5
  |
4 |     b: String,
  |     ^^^^^^^^^
  |
  = note: `#[warn(dead_code)]` on by default

warning: 1 warning emitted

Finished dev [unoptimized + debuginfo] target(s) in 0.01s

Raw artifacts:
{
fileName: '/workspaces/rust/lab/target/debug/experiments',
name: 'experiments',
kind: 'bin'
}
Filtered artifacts:
{
fileName: '/workspaces/rust/lab/target/debug/experiments',
name: 'experiments',
kind: 'bin'
}
configuration: {
type: 'lldb',
request: 'launch',
name: "Debug executable 'experiments'",
args: [],
cwd: '${workspaceFolder}',
__configurationTarget: 5,
terminal: 'integrated',
relativePathBase: '/workspaces/rust/lab/experiments',
program: '/workspaces/rust/lab/target/debug/experiments',
sourceLanguages: [ 'rust' ]
}
liblldb: /usr/lib/liblldb.so.12
environment: {}
params: {
evaluateForHovers: true,
commandCompletions: true,
sourceLanguages: [ 'rust' ]
}
thread '' panicked at 'OS can't spawn a new worker thread: Os { code: 1, kind: PermissionDenied, message: "Operation not permitted" }', /opt/rust/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.16.1/src/runtime/blocking/pool.rs:297:14
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
Debug adapter exit code=101, signal=null.

@vadimcn vadimcn added the cause:Unclear The cause of the issue is unclear and/or I was not able to reproduce it. label Mar 20, 2022
@vadimcn
Copy link
Owner

vadimcn commented Mar 20, 2022

If I had to guess, this probably has something to do with permissions of your container.

@meskill
Copy link
Author

meskill commented Mar 21, 2022

I'm using an unprivileged user in container. But I've tried to build image as USER root and got same error

@vadimcn
Copy link
Owner

vadimcn commented Mar 21, 2022

Running as root inside a container does not make it privileged. To make a container privileged, you'll need to start it with --privileged --security-opt="seccomp=unconfined". This is the case on plain Linux at least; but since you are running container inside a WSL VM on Windows, there may be further complications.

@meskill
Copy link
Author

meskill commented Mar 21, 2022

I've just meant that I'm using the non-root user by default that may lead for some access problems but using root user didn't change anything.

I thought smth went wrong on extension install as there is no such directory as /opt/rust for me. Can you point out when or how this /opt/rust/ directory is filled?

@vadimcn
Copy link
Owner

vadimcn commented Mar 21, 2022

That is the source location on my build machine. You should not expect to find it on yours.

@meskill
Copy link
Author

meskill commented Mar 21, 2022

oh, well, showing paths that way in an error is a little misleading :)

so, that means I've just have some permission problems inside the container that doesn't allow extension to create threads?
Do you have any idea what should I check to figure out how to provide that permissions to the extension?

@vadimcn
Copy link
Owner

vadimcn commented Mar 21, 2022

I don't know. I am not a Docker expert myself. I suggest starting with unconfined container, if that works, the problem is likely in container permissions. If not, it must be something specific to WSL, of which I know even less.

@vadimcn
Copy link
Owner

vadimcn commented May 28, 2022

Any updates?

@vadimcn vadimcn added the waiting for info Waiting for the issue author to provide more information. label May 28, 2022
@meskill
Copy link
Author

meskill commented Jun 4, 2022

Hello, I've done some more testing recently. Seems like an issue with the alpine image itself, as it works out of the box with other version of rust docker image (base rust and slim).

So, it is more about #391, although I've used glibc compatibility layer. While testing, I've got various kinds of errors and the error about permission is from my last attempt while trying to make debugger run. As I barely know why it happens and a lack of system knowledge I cannot provide any additional info or idea how to fix it.

Closing issue in favor of #391 as more general solution for the Alpine.

@meskill meskill closed this as completed Jun 4, 2022
@meskill meskill closed this as not planned Won't fix, can't repro, duplicate, stale Jun 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cause:Unclear The cause of the issue is unclear and/or I was not able to reproduce it. waiting for info Waiting for the issue author to provide more information.
Projects
None yet
Development

No branches or pull requests

2 participants