QuantConnect / pythonnet

Python for .NET is a package that gives Python programmers nearly seamless integration with the .NET Common Language Runtime (CLR) and provides a powerful application scripting tool for .NET developers.
http://pythonnet.github.io
MIT License
28 stars 26 forks source link

Fix deadlock when shuting down #30

Closed Martin-Molinero closed 5 years ago

Martin-Molinero commented 5 years ago

Cherry-picking last commit from PR https://github.com/pythonnet/pythonnet/pull/852 .

Tested executing https://github.com/QuantConnect/Lean Python unit and regression tests and PythonNet unit tests [multiple times].

jaredbroad commented 5 years ago

Please see if you can pin the threads used to 1 core to confirm low processor environments

Martin-Molinero commented 5 years ago

Please see if you can pin the threads used to 1 core to confirm low processor environments

The deadlock was reproductible with the python Net unit tests https://github.com/pythonnet/pythonnet/pull/852#discussion_r279535174 in windows, caused by the using (Py.GIL()) statement