GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — TSAN race in _waiting_release · Issue #123828 · python/cpython

TSAN race in _waiting_release #123828

New issue
Copy link
New issue
Copy link
Closed
#124107
Closed
TSAN race in _waiting_release#123828
#124107
Copy link
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirtopic-subinterpreterstype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@ccotter
ccotter
opened on Sep 8, 2024
Issue body actions

Bug report

Bug description:

A TSAN (gcc-12) build of the latest version of cpython reports a race in the test_send_recv_different_interpreters_and_threads test:

  Read of size 4 at 0x7ffe8d0c9338 by main thread:
    #0 _waiting_finish_releasing Modules/_interpchannelsmodule.c:504 (_interpchannels.cpython-314-x86_64-linux-gnu.so+0x88f4) (BuildId: 233ea3cec8e2d6b4a5322cdab2aa3fcc24ab85f8)
    #1 channel_send_wait Modules/_interpchannelsmodule.c:1852 (_interpchannels.cpython-314-x86_64-linux-gnu.so+0x88f4)
    #2 channelsmod_send Modules/_interpchannelsmodule.c:3096 (_interpchannels.cpython-314-x86_64-linux-gnu.so+0x8dd0) (BuildId: 233ea3cec8e2d6b4a5322cdab2aa3fcc24ab85f8)
    #3 cfunction_call Objects/methodobject.c:540 (python+0x549e55) (BuildId: f667f6a4a823ca3db627f9e7bf3836f7af978c6d)

    #0 _waiting_release Modules/_interpchannelsmodule.c:498 (_interpchannels.cpython-314-x86_64-linux-gnu.so+0x37c7) (BuildId: 233ea3cec8e2d6b4a5322cdab2aa3fcc24ab85f8)
    #1 channel_recv Modules/_interpchannelsmodule.c:1937 (_interpchannels.cpython-314-x86_64-linux-gnu.so+0x863a) (BuildId: 233ea3cec8e2d6b4a5322cdab2aa3fcc24ab85f8)
    #2 channelsmod_recv Modules/_interpchannelsmodule.c:3189 (_interpchannels.cpython-314-x86_64-linux-gnu.so+0x863a)

Indeed,

cpython/Modules/_interpchannelsmodule.c

Line 504 in 8b209fd

while (waiting->status == WAITING_RELEASING) {
spin waits for waiting->status to change state, with

cpython/Modules/_interpchannelsmodule.c

Line 498 in 8b209fd

waiting->status = WAITING_RELEASED;
triggering the spinning thread to exit the spin. Neither happens under a mutex, or with any release-acquire sequencing.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

  • gh-123828: fix data raceing for _waiting_release method in _interpchannelsmodule.c #124107
  • [3.14] gh-123828: Fix data race in _interpchannels._waiting_release (GH-124107) #139517

Activity

  1. ccotter
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Sep 8, 2024
  2. ZeroIntensity commented on Sep 8, 2024

    @ZeroIntensity
    ZeroIntensity
    on Sep 8, 2024
    Member
    More actions

    cc @ericsnowcurrently

  3. picnixz
    added
    extension-modulesC modules in the Modules dirC modules in the Modules dir
    topic-subinterpreters
    on Sep 8, 2024
  4. github-project-automation
    added this to Subinterpreterson Sep 8, 2024
  5. github-project-automation
    moved this to Todo in Subinterpreterson Sep 8, 2024
  6. n-bes commented on Sep 11, 2024

    @n-bes
    n-bes
    on Sep 11, 2024
    More actions

    Can confirm, reproduced on Python-3.13.0b4

    • Build 182

      • build script
      • logs
    • Build 183

      • build script
      • logs
    • Build 186

      • build script
      • logs

    p.s. summary table

    If I remember correctly, this OOM related with this issue

    Снимок экрана 2024-08-13 в 11 20 37
  7. Zheaoli
    added a commit that references this issue on Sep 15, 2024

    pythongh-123828: fix data raceing for _waiting_release method in _int…

    ffee4ed
  8. ZeroIntensity
    added a commit that references this issue on Oct 1, 2025

    gh-123828: Fix data race in `_interpchannels._waiting_release` (GH-12…

    f39dea3
  9. ZeroIntensity
    closed this as completedin #124107on Oct 1, 2025
  10. github-project-automation
    moved this from Todo to Done in Subinterpreterson Oct 1, 2025
  11. miss-islington
    added a commit that references this issue on Oct 2, 2025

    pythongh-123828: Fix data race in `_interpchannels._waiting_release` (p…

    1f12623
  12. ZeroIntensity
    added a commit that references this issue on Oct 7, 2025

    [3.14] gh-123828: Fix data race in `_interpchannels._waiting_release` (…

    a69bdab
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

    extension-modulesC modules in the Modules dirC modules in the Modules dirtopic-subinterpreterstype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    • Subinterpreters
      Status
      Done
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.