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

Investigate implementation of PyOS_CheckStack on OSX #69704

Closed
ronaldoussoren opened this issue Oct 30, 2015 · 1 comment
Closed

Investigate implementation of PyOS_CheckStack on OSX #69704

ronaldoussoren opened this issue Oct 30, 2015 · 1 comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) OS-mac type-bug An unexpected behavior, bug, or error

Comments

@ronaldoussoren
Copy link
Contributor

BPO 25518
Nosy @ronaldoussoren, @ned-deily
Superseder
  • bpo-33955: Implement PyOS_CheckStack on macOS using pthread_get_stack*_np
  • 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-08-31.18:18:01.621>
    created_at = <Date 2015-10-30.16:12:03.750>
    labels = ['OS-mac', 'interpreter-core', 'type-bug']
    title = 'Investigate implementation of PyOS_CheckStack on OSX'
    updated_at = <Date 2019-08-31.18:18:01.620>
    user = 'https://github.com/ronaldoussoren'

    bugs.python.org fields:

    activity = <Date 2019-08-31.18:18:01.620>
    actor = 'ned.deily'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-08-31.18:18:01.621>
    closer = 'ned.deily'
    components = ['Interpreter Core', 'macOS']
    creation = <Date 2015-10-30.16:12:03.750>
    creator = 'ronaldoussoren'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 25518
    keywords = []
    message_count = 1.0
    messages = ['253742']
    nosy_count = 2.0
    nosy_names = ['ronaldoussoren', 'ned.deily']
    pr_nums = []
    priority = 'low'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '33955'
    type = 'behavior'
    url = 'https://bugs.python.org/issue25518'
    versions = ['Python 3.6']

    @ronaldoussoren
    Copy link
    Contributor Author

    On OSX 10.4 or later the following functions are available:

    size_t pthread_get_stacksize_np(pthread_t);
    void* pthread_get_stackaddr_np(pthread_t);

    These functions could be used to implement PyOS_CheckStack on OSX. The advantage of this would be that it would get less likely that recursion causes hard crashes when the recursion limit is not optimally tuned to the stack size on OSX. (Note that OSX has a fixed size stack for the main thread as well, AFAIK unlike linux).

    The disadvantage of implementing this is that a naive implementation might have a negative performance impact. It should be possible to avoid this by caching the return values of these functions in the thread state.

    Another disadvantage according to a quick search on Google: pthread_get_stacksize_np appears to be buggy on some OSX versions, which requires workarounds to get the right behavior.

    @ronaldoussoren ronaldoussoren added interpreter-core (Objects, Python, Grammar, and Parser dirs) OS-mac type-bug An unexpected behavior, bug, or error labels Oct 30, 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
    interpreter-core (Objects, Python, Grammar, and Parser dirs) OS-mac type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants