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

Getting context already set error #42

Open
claesnl opened this issue Sep 17, 2024 · 1 comment
Open

Getting context already set error #42

claesnl opened this issue Sep 17, 2024 · 1 comment

Comments

@claesnl
Copy link
Contributor

claesnl commented Sep 17, 2024

For some nodes, I get the below error the first time i run docker compose up --build, however if I stop and start the same command again, it runs without errors. The problem is that the error is also present on the production nodes, requiring manual extra steps to reload the nodes.

rh-node-public_glio-1       | INFO:     Started server process [1]
rh-node-public_glio-1       | INFO:     Waiting for application startup.
rh-node-public_glio-1       | ERROR:    Traceback (most recent call last):
rh-node-public_glio-1       |   File "/opt/conda/lib/python3.10/site-packages/starlette/routing.py", line 693, in lifespan
rh-node-public_glio-1       |     async with self.lifespan_context(app) as maybe_state:
rh-node-public_glio-1       |   File "/opt/conda/lib/python3.10/site-packages/starlette/routing.py", line 569, in __aenter__
rh-node-public_glio-1       |     await self._router.startup()
rh-node-public_glio-1       |   File "/opt/conda/lib/python3.10/site-packages/starlette/routing.py", line 670, in startup
rh-node-public_glio-1       |     await handler()
rh-node-public_glio-1       |   File "/opt/conda/lib/python3.10/site-packages/rhnode/rhnode.py", line 357, in register_on_startup
rh-node-public_glio-1       |     multiprocessing.set_start_method("spawn")
rh-node-public_glio-1       |   File "/opt/conda/lib/python3.10/multiprocessing/context.py", line 247, in set_start_method
rh-node-public_glio-1       |     raise RuntimeError('context has already been set')
rh-node-public_glio-1       | RuntimeError: context has already been set
rh-node-public_glio-1       | 
rh-node-public_glio-1       | ERROR:    Application startup failed. Exiting.
rh-node-public_glio-1 exited with code 3

The error appears to be related to multi processing (the above node uses multiprocessing for nnunet).
pytorch/pytorch#3492

Perhaps we need to modify?:
https://github.com/CAAI/rh-node/blob/9c5f474ba8443911eca1d4530ad4a5dd8d231c5e/rhnode/rhnode.py#L357C13-L357C54

@claesnl
Copy link
Contributor Author

claesnl commented Sep 23, 2024

Just for future use, the trick is to do:
cd /etc/docker/compose/rh-node
docker compose down
docker compose up
(wait for it to crash and do CTRL+C)
docker compose up -d --remove-orphans

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