Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

On shutdown from Python release all slot holders#1720

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed

Conversation

filmor
Copy link
Member

What does this implement/fix? Explain your changes.

Before this fix slots of reflected types were not released to Python defaults leaving Python referencing managed code after managed runtime has already shut down.

In the original bug, the runtime in question is Mono aftermono_jit_cleanup.

This is an extension of#1712 and actually calls shutdown from Python.

Does this close any currently open issues?

#1683

@filmor
Copy link
MemberAuthor

The errors we are hitting here are the reason why we didn't do the full shutdown in the past. They only occur when running the full suitein sequence (I'm trying to find the minimal permutation that "works", but it's tricky).

@filmor
Copy link
MemberAuthor

filmor commentedMar 27, 2022
edited
Loading

The minimal call I have found so far that reproduces the segfault is

pytest --runtime mono tests/test_method.py tests/test_subclass.py

EDIT: Even further:

pytest --runtime mono -k "test_create_instance"

Code for this test:

deftest_create_instance():
"""Test derived instances can be created from managed code"""
DerivedClass=derived_class_fixture(test_create_instance.__name__)
ob=FunctionsTest.create_instance(DerivedClass)
assertob.foo()=="DerivedClass"
assertFunctionsTest.test_foo(ob)=="DerivedClass"
assertob.bar("bar",2)=="bar_bar"
assertFunctionsTest.test_bar(ob,"bar",2)=="bar_bar"
assertob.not_overriden()=="not_overriden"
x=FunctionsTest.pass_through(ob)
assertid(x)==id(ob)
InterfaceTestClass=interface_test_class_fixture(test_create_instance.__name__)
ob2=FunctionsTest.create_instance_interface(InterfaceTestClass)
assertob2.foo()=="InterfaceTestClass"
assertFunctionsTest.test_foo(ob2)=="InterfaceTestClass"
assertob2.bar("bar",2)=="bar/bar"
assertFunctionsTest.test_bar(ob2,"bar",2)=="bar/bar"
y=FunctionsTest.pass_through_interface(ob2)
assertid(y)!=id(ob2)

EDIT: Latest result:

If the wholesubclass suite is run, there is no crash. If the whole test-suite is run without thesubclass, there is no crash either. Pretty :)

Just excludingtest_create_instance works reproducibly as well.

EDIT: The exact line creating the leak(?) is

assertob.not_overriden()=="not_overriden"

@filmor
Copy link
MemberAuthor

@lostmsu This runs through now, but we are not doing thePyObject_GC_Del anymore. Where is the corresponding object creation?

@lostmsu
Copy link
Member

@filmor you would be looking for callers ofPythonDerivedType.SetPyObj

@filmorfilmorforce-pushed thebugs/ShutdownSegFault branch fromdbb510b to01f473fCompareMarch 31, 2022 07:00
@lostmsu
Copy link
Member

I know it is annoying, but can you untangle the fix for the issue from the syntax changes?

Also, I think you might have accidentally changed line endings in the interop .tt file.

@lostmsu
Copy link
Member

lostmsu commentedMar 31, 2022
edited
Loading

BTW, re the original issue: I haven't looked at it yet, but it might have to do with the defaulttp_dealloc,tp_clear, or (unlikely)tp_traverse being inadequate for derived type instances with their GC untrack "magic". This situation could probably be detected in the finalizer or during shutdown.

@lostmsu
Copy link
Member

Superseded by#1712

@lostmsulostmsu closed thisApr 8, 2022
@filmorfilmor deleted the bugs/ShutdownSegFault branchNovember 9, 2022 11:30
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@filmor@lostmsu

[8]ページ先頭

©2009-2025 Movatter.jp