Skip to content

Getting context already set error #42

@claesnl

Description

@claesnl

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions