Skip to content
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

Segfault on GC cleanup of subclass #407

Closed
omerbenamram opened this issue Mar 20, 2019 · 1 comment · Fixed by #721
Closed

Segfault on GC cleanup of subclass #407

omerbenamram opened this issue Mar 20, 2019 · 1 comment · Fixed by #721

Comments

@omerbenamram
Copy link
Contributor

I'm not eniertly sure that it's specific to only subclasses, I've noticed this bug while working on the tests in rustapi_module.

🌍 Environment

  • Your operating system and version: osx 10.14
  • Your python version: all cpython versions
  • Your rust version (rustc --version): rustc 1.35.0-nightly (88f755f8a 2019-03-07)
  • Are you using the latest pyo3 version? master

💥 Reproducing

current code in https://github.com/PyO3/pyo3/blob/master/examples/rustapi_module/tests/test_subclassing.py

from rustapi_module.subclassing import Subclassable


class SomeSubClass(Subclassable):
    pass


a = SomeSubClass()
_b = str(a) + repr(a)

changing it to:

from rustapi_module.subclassing import Subclassable


class SomeSubClass(Subclassable):
    pass

def test_f():
    a = SomeSubClass()
    _b = str(a) + repr(a)

causes it to crash, looking at the core dump, it seems to be during garbage collection.

image

changing it to:

from rustapi_module.subclassing import Subclassable


class SomeSubClass(Subclassable):
    pass


a = SomeSubClass()
a = SomeSubClass()
a = SomeSubClass()
a = SomeSubClass()
a = SomeSubClass()
_b = str(a) + repr(a)

makes this crash with GC is already tracked message.

@konstin
Copy link
Member

konstin commented Mar 20, 2019

That's a duplicate of #220 but with a new case and an interesting error message

konstin added a commit that referenced this issue Jul 15, 2019
See #220 and #407 for details on those segfaults
konstin added a commit that referenced this issue Aug 5, 2019
See #220 and #407 for details on those segfaults
Alexander-N added a commit to Alexander-N/pyo3 that referenced this issue Jan 11, 2020
Add a testcase from PyO3#407. Both test cases don't segfault after the
change to the #[pyclass] system in PyO3#683.

Closes PyO3#407
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants