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

Refcount error and file descriptor leaks in pwd, grp modules #49123

Closed
baikie mannequin opened this issue Jan 7, 2009 · 2 comments
Closed

Refcount error and file descriptor leaks in pwd, grp modules #49123

baikie mannequin opened this issue Jan 7, 2009 · 2 comments
Labels
extension-modules C modules in the Modules dir performance Performance or resource usage

Comments

@baikie
Copy link
Mannequin

baikie mannequin commented Jan 7, 2009

BPO 4873
Nosy @loewis
Files
  • minor.diff: Fix refcount error and fd leaks
  • 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 2009-05-29.16:05:21.068>
    created_at = <Date 2009-01-07.22:30:45.644>
    labels = ['extension-modules', 'performance']
    title = 'Refcount error and file descriptor leaks in pwd, grp modules'
    updated_at = <Date 2009-05-29.16:05:21.061>
    user = 'https://bugs.python.org/baikie'

    bugs.python.org fields:

    activity = <Date 2009-05-29.16:05:21.061>
    actor = 'loewis'
    assignee = 'none'
    closed = True
    closed_date = <Date 2009-05-29.16:05:21.068>
    closer = 'loewis'
    components = ['Extension Modules']
    creation = <Date 2009-01-07.22:30:45.644>
    creator = 'baikie'
    dependencies = []
    files = ['12639']
    hgrepos = []
    issue_num = 4873
    keywords = ['patch']
    message_count = 2.0
    messages = ['79378', '88513']
    nosy_count = 2.0
    nosy_names = ['loewis', 'baikie']
    pr_nums = []
    priority = 'normal'
    resolution = 'accepted'
    stage = None
    status = 'closed'
    superseder = None
    type = 'resource usage'
    url = 'https://bugs.python.org/issue4873'
    versions = []

    @baikie
    Copy link
    Mannequin Author

    baikie mannequin commented Jan 7, 2009

    When investigating issue bpo-4859 I found that when pwd.getpwall()
    and grp.getgrall() fail due to decoding errors, they leave open
    file descriptors referring to the passwd and group files, since
    they don't call the end*ent() functions in this case. Also, the
    grp.* functions have a reference counting error when they fail in
    this way - a debug build reports that an object's reference count
    goes to -1. What I think happens is that in mkgrent(),
    PyStructSequence_SET_ITEM steals the reference to "w", meaning
    that the "Py_DECREF(w)" call shouldn't be made afterwards. The
    attached diff fixes both of these problems, I think, and applies
    to the 2.x and 3.x branches.

    @baikie baikie mannequin added extension-modules C modules in the Modules dir performance Performance or resource usage labels Jan 7, 2009
    @loewis
    Copy link
    Mannequin

    loewis mannequin commented May 29, 2009

    Thanks for the patch. Committed as r73016, r73017, r73018, r73019.

    @loewis loewis mannequin closed this as completed May 29, 2009
    @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
    extension-modules C modules in the Modules dir performance Performance or resource usage
    Projects
    None yet
    Development

    No branches or pull requests

    0 participants