-
Notifications
You must be signed in to change notification settings - Fork 748
Python.exe crashes if __pycache__ directories exist (garbage collection trashed) #481
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
Comments
did you try running python with -B flag? |
I've tried this: in 4 of 5 attempts, python interpreter 3.5 64-bit crashes at the exit. No pycache directores exist in this case. |
I haven't seen yoyr sample code, this isn't related to the sub classing bug right? I'm curious if pycache existed when the subclass tests failed |
You zip file does not include Axa.* .NET dependencies. |
@vmuriart @denfromufa and class.dll is made somehow. |
@vmuriart |
I see that it is self-contained now - Aka namespace is in the same class.cs. |
I nailed bug in src\runtime\typemananger.cs in CreateSubType(): method Runtime.XIncref() is not called, but PyObject is created and added to disposeList. Correct code:
Now it doesn't crash anymore. Would be not easy to make regression test out of it. I realized that no crash if this code is completely in one .py. It must be spread among several modules to provoke garbage collector crash. |
Nice! The subclass tests might catch this. Even though it's intermittent I run it multiple times each version to check for it. |
If it works in your tests then you can submit this patch to repo. |
@testrunner123 would you like to submit a pull request? otherwise someone can do this for you and attribute the commit to you |
Hmm, we had quite a few of those. Maybe we should replace the current |
@filmor i agree about |
I didn't think much about the names, I'll try to get a PR up with a proposal for explicit constructors. |
@filmor the fix seems to be merged. Can this bug be closed? |
I think so, yes. |
Environment
Details
I am trying to import .NET assemblies and use them together. Unfortunately, python interpreter always crashes if .py files are already precompiled and lay inside pycache directories. I tried breifly python 3.6 and newer pythonnet, but it still crashes. However it doesn't crash with old python 2.7.13 64-bit (need to recompile pythonnet for 2.7).
I used Debugger and see that python garbage collection is trashed. Mostly object->tp_is_gc field is invalid not showing to real function.
Deleteing pycache directories allow test.py to run once.
Please, help in identify the issue and in making the fix.
pythonGCCrash.zip
The crash happens mostly inside visit_decref() function in PyObject_IS_GC(op) macro. It shows either "op" is 0 or "op->tp_is_gc" has a wrong address.
The text was updated successfully, but these errors were encountered: