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

Deletion of autoTSSkey during runtime finalization is not safe #131185

Closed
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error
@colesbury

Description

@colesbury

Bug report

TheautoTssKey is deleted during_PyRuntimeState_Fini bygilstate_tss_fini. This isn't safe because other threads may try callingPyGILState_Ensure() orPyGILState_GetThisThreadState() concurrently during shutdown.

void
_PyRuntimeState_Fini(_PyRuntimeState*runtime)
{
#ifdefPy_REF_DEBUG
/* The count is cleared by _Py_FinalizeRefTotal(). */
assert(runtime->object_state.interpreter_leaks==0);
#endif
if (gilstate_tss_initialized(runtime)) {
gilstate_tss_fini(runtime);
}
if (PyThread_tss_is_created(&runtime->trashTSSkey)) {
PyThread_tss_delete(&runtime->trashTSSkey);
}
}

We can:

  1. ConvertautoTssKey to a_Py_thread_local like_Py_tss_tstate, which doesn't require deletion
  2. Don't deleteautoTssKey at runtime finalization

My preference is for the first option.

cc@ZeroIntensity@ericsnowcurrently@gpshead

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp