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

PEP 475: Enhance faulthandler to handle better reentrant calls #68024

Closed
vstinner opened this issue Apr 1, 2015 · 2 comments
Closed

PEP 475: Enhance faulthandler to handle better reentrant calls #68024

vstinner opened this issue Apr 1, 2015 · 2 comments

Comments

@vstinner
Copy link
Member

vstinner commented Apr 1, 2015

BPO 23836
Nosy @vstinner
Files
  • py_write_noraise.patch
  • traceback_eintr.patch
  • faulthandler_eintr.patch
  • 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 2015-04-01.16:52:11.847>
    created_at = <Date 2015-04-01.09:43:59.254>
    labels = []
    title = 'PEP 475: Enhance faulthandler to handle better reentrant calls'
    updated_at = <Date 2015-04-01.16:52:11.846>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2015-04-01.16:52:11.846>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2015-04-01.16:52:11.847>
    closer = 'vstinner'
    components = []
    creation = <Date 2015-04-01.09:43:59.254>
    creator = 'vstinner'
    dependencies = []
    files = ['38775', '38776', '38777']
    hgrepos = []
    issue_num = 23836
    keywords = ['patch']
    message_count = 2.0
    messages = ['239776', '239829']
    nosy_count = 3.0
    nosy_names = ['vstinner', 'neologix', 'python-dev']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue23836'
    versions = ['Python 3.4', 'Python 3.5']

    @vstinner
    Copy link
    Member Author

    vstinner commented Apr 1, 2015

    While working on the PEP-475, I noticed that the faulthandler module doesn't handle well reentrant calls to its signal handlers. If a signal is received while faulthandler is displaying the traceback, faulthandler restarts to display a new traceback (and then finish to display the previous traceback).

    Moreover, faulthandler uses the C function write() to display the traceback and it ignores write() errors. It should retry write() if write() is interrupted by a signal (fails with EINTR).

    Attached py_write_noraise.patch:

    • Add a new _Py_write_noraise() function
    • Document functions releasing the GIL

    Attached traceback_eintr.patch:

    • Modify functions displaying traceback to use _Py_write_noraise() instead of write()

    Attached faulthandler_eintr.patch:

    • Add a reentrant flag to the two signal handlers of faulthandler
    • Modify faulthandler.dump_traceback() to call PyErr_CheckSignals(), to call the Python signal handler if a signal was received while faulthandler was displaying the traceback of all Python threads

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Apr 1, 2015

    New changeset 60e001ec141d by Victor Stinner in branch 'default':
    Issue bpo-23836: Add _Py_write_noraise() function
    https://hg.python.org/cpython/rev/60e001ec141d

    New changeset d9b9e2a68e7c by Victor Stinner in branch 'default':
    Issue bpo-23836: Document functions releasing the GIL in fileutils.c
    https://hg.python.org/cpython/rev/d9b9e2a68e7c

    New changeset 12e065efc821 by Victor Stinner in branch 'default':
    Issue bpo-23836: Use _Py_write_noraise() to retry on EINTR in trip_signal() of
    https://hg.python.org/cpython/rev/12e065efc821

    New changeset e3c97621d8b4 by Victor Stinner in branch 'default':
    Issue bpo-23836: Use _Py_write_noraise() to retry on EINTR in child_exec() of
    https://hg.python.org/cpython/rev/e3c97621d8b4

    New changeset 29ab05c5e9dc by Victor Stinner in branch 'default':
    Issue bpo-23836: Use _Py_write_noraise() to retry on EINTR in _Py_DumpTraceback()
    https://hg.python.org/cpython/rev/29ab05c5e9dc

    New changeset f07b855afbb2 by Victor Stinner in branch 'default':
    Issue bpo-23836: Fix the faulthandler module to handle reentrant calls
    https://hg.python.org/cpython/rev/f07b855afbb2

    @vstinner vstinner closed this as completed Apr 1, 2015
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    None yet
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant