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 — posixmodule uses PyOS_setsig to save & restore signal handlers · Issue #114727 · python/cpython

posixmodule uses PyOS_setsig to save & restore signal handlers #114727

New issue
Copy link
New issue
Copy link
Open
Open
posixmodule uses PyOS_setsig to save & restore signal handlers#114727
Copy link
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirtopic-free-threading

Description

@encukou
encukou
opened on Jan 29, 2024
Issue body actions

posixmodule ignores signals in os_openpty_impl and os_grantpt_impl by wrapping them in two PyOS_setsig calls:

   sig_saved = PyOS_setsig(SIGCHLD, SIG_DFL);
    ...
    PyOS_setsig(SIGCHLD, sig_saved);

This relies on the GIL being held, so it probably needs a dedicated lock in free-threading builds.

Linked PRs

  • gh-114727: Update os_{openpty|grantpt}_impl to use per module lock. #117017

Activity

  1. encukou
    added
    topic-free-threading
    on Jan 29, 2024
  2. erlend-aasland
    added
    extension-modulesC modules in the Modules dirC modules in the Modules dir
    on Jan 29, 2024
  3. corona10
    added a commit that references this issue on Mar 19, 2024

    pythongh-114727: Update os_{openpty|grantpt}_impl to use per module l…

    38fb2b3
  4. corona10 commented on Mar 19, 2024

    @corona10
    corona10
    on Mar 19, 2024
    Member
    More actions

    @colesbury @erlend-aasland
    Hmm, Do we need something like per signal API lock for the interpreter-wide that acquires lock when we need to call PyOS_setsig at any moment?

    For example, if any thread needs to call PyOS_setsig or PyOS_getsig, is it required to acquire the specific interpreter-wise lock?

    Py_BEGIN_CRITICAL_SECTION(interp->signal);
    PyOS_setsig
    ..
    
    PyOS_getsig
    ...
    Py_END_CRITCIAL_SECTION();

    And then add assertion(_Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED) inside of PyOS_setsig abnd PyOS_getsig

    Or instead we can use lightweight locking API for the same purpose.

    note: IIUC, PyOS_setsig is process-wide.

    Reacted by Erlend E. Aasland
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-free-threading

    Projects

    No projects

      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.