Skip to content

Py_Finalize() doesn't stop daemon threads #68958

Description

@AlexBudovski
BPO 24770
Nosy @ericsnowcurrently
Superseder
  • bpo-36476: Runtime finalization assumes all other threads have exited.
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2019-12-20.23:33:07.623>
    created_at = <Date 2015-08-01.06:08:55.461>
    labels = ['extension-modules', 'interpreter-core', '3.8', '3.9', 'type-crash']
    title = "Py_Finalize() doesn't stop daemon threads"
    updated_at = <Date 2019-12-20.23:33:07.617>
    user = 'https://bugs.python.org/AlexBudovski'

    bugs.python.org fields:

    activity = <Date 2019-12-20.23:33:07.617>
    actor = 'eric.snow'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-12-20.23:33:07.623>
    closer = 'eric.snow'
    components = ['Extension Modules', 'Interpreter Core']
    creation = <Date 2015-08-01.06:08:55.461>
    creator = 'Alex Budovski'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 24770
    keywords = []
    message_count = 2.0
    messages = ['247798', '358746']
    nosy_count = 2.0
    nosy_names = ['eric.snow', 'Alex Budovski']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '36476'
    type = 'crash'
    url = 'https://bugs.python.org/issue24770'
    versions = ['Python 3.8', 'Python 3.9']

    Activity

    1. AlexBudovski commented on Aug 1, 2015

      AlexBudovskimannequin
      MannequinAuthor

      This is a known issue, from the comment, but it is causing AVs for my embedded application when background threads are created, for example, by the _socket builtin module.

      /* Undo the effect of Py_Initialize().

      Beware: if multiple interpreter and/or thread states exist, these
      are not wiped out; only the current thread and interpreter state
      are deleted. But since everything else is deleted, those other
      interpreter and thread states should no longer be used.

      (XXX We should do better, e.g. wipe out all interpreters and
      threads.)

      Locking: as above.

      */

      void
      Py_Finalize(void)
    2. added
      interpreter-core(Objects, Python, Grammar, and Parser dirs)
      type-crashA hard crash of the interpreter, possibly with a core dump
      on Aug 1, 2015
    3. changed the title [-]Py_Finalize not cleaning up all threads[/-] [+]Py_Finalize() doesn't stop daemon threads[/+] on Oct 23, 2019
    4. ericsnowcurrently commented on Dec 20, 2019

      @ericsnowcurrently
      Member

      I'm closing this in favor of bpo-36476 "Runtime finalization assumes all other threads have exited."

    5. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.8 (EOL)end of life3.9 (EOL)end of lifeextension-modulesC modules in the Modules dirinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-crashA hard crash of the interpreter, possibly with a core dump

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions