pythonnet / pythonnet/clr-loader
Deadlock calling pythonnet.set_runtime twice
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 42
- Forks
- 32
- Avg merge
- 14h 1m
- Merged PRs (30d)
- 1
Description
With the update to delay the load of the runtime from 0.25 to 0.26 a deadlock occurs with following code
import pythonnet
pythonnet.set_runtime("coreclr")
pythonnet.set_runtime("coreclr")
This is explicit a problem of the core clr. We did not see that with .NET FF.
We tracked it down to
https://github.com/pythonnet/clr-loader/blob/a88b6a1a0086278e3518f373487ae8819023cb2e/clr_loader/hostfxr.py#L135
this function deadlocks the second time called if
https://github.com/pythonnet/clr-loader/blob/a88b6a1a0086278e3518f373487ae8819023cb2e/clr_loader/hostfxr.py#L146
was not called before.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the two consecutive pythonnet.set_runtime("coreclr") calls, then inspect clr_loader/hostfxr.py around lines 135 and 146 as identified in the report. Confirm the second call no longer deadlocks while preserving the existing behavior for .NET Framework and CoreCLR runtime loading.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100