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

code-runner: resource temporarily unavailable #6

Open
matejrisek opened this issue May 2, 2022 · 1 comment
Open

code-runner: resource temporarily unavailable #6

matejrisek opened this issue May 2, 2022 · 1 comment

Comments

@matejrisek
Copy link

matejrisek commented May 2, 2022

Hi, I'm trying to run the project locally with docker. The examples from the API work fine until I try to run the example code - the run hangs waiting on the response from the python container.

From what I see the container dies immediately with:

exec /nix/store/mv32i0sb8sjpxlzj0p0dmx5sphy2arbw-rust_code-runner-1.2.0/bin/code-runner: resource temporarily unavailable

edit: Directly running the container from the image works:

> docker run -it glot/python:latest
{"language": "python", "files": [{"name": "main.py", "content": "print(42)"}]}
{"stdout":"42\n","stderr":"","error":""}

I'm using the latest image glot/python:latest.

Do you know what could be the root cause for it?

edit: It seems nproc limit is causing this issue.
If I completely remove it from the container creation everything works fine.
But if it is present, even with seemingly ridiculous values like:

            "Ulimits": [
                {
                    "Name": "nofile",
                    "Hard": 100,
                    "Soft": 90
                },
                {
                    "Name": "nproc",
                    "Hard": 100000,
                    "Soft": 200
                }
            ],

It starts erroring.

Many thanks,
Matej

@matejrisek
Copy link
Author

matejrisek commented May 3, 2022

I've opened a PR to address this issue glotcode/glot-languages#4.

TLDR: When the user is created in any of the glot images it is created with UID 1000. UID 1000 is also a default local user ID.
To enforce ulimits like nproc we then read the numbers for the local user, and that's why it fails if nproc is set to a relatively low value like it is by default (100).

Thanks to kind people of Reddit for figuring it out -> Reddit link

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

1 participant