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

Unnecessary Cache of Shared Object Handles #88061

Closed
insertinterestingnamehere mannequin opened this issue Apr 20, 2021 · 4 comments
Closed

Unnecessary Cache of Shared Object Handles #88061

insertinterestingnamehere mannequin opened this issue Apr 20, 2021 · 4 comments
Assignees
Labels
3.11 only security fixes

Comments

@insertinterestingnamehere
Copy link
Mannequin

BPO 43895
Nosy @Yhg1s, @brettcannon, @gpshead, @ncoghlan, @ericsnowcurrently, @insertinterestingnamehere
PRs
  • bpo-43895: Remove an unnecessary cache of shared object handles #25487
  • 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 = 'https://github.com/gpshead'
    closed_at = <Date 2021-07-07.23:26:50.342>
    created_at = <Date 2021-04-20.17:00:51.537>
    labels = ['3.11']
    title = 'Unnecessary Cache of Shared Object Handles'
    updated_at = <Date 2021-07-07.23:26:50.341>
    user = 'https://github.com/insertinterestingnamehere'

    bugs.python.org fields:

    activity = <Date 2021-07-07.23:26:50.341>
    actor = 'gregory.p.smith'
    assignee = 'gregory.p.smith'
    closed = True
    closed_date = <Date 2021-07-07.23:26:50.342>
    closer = 'gregory.p.smith'
    components = []
    creation = <Date 2021-04-20.17:00:51.537>
    creator = 'Ian.H'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 43895
    keywords = ['patch']
    message_count = 4.0
    messages = ['391453', '391454', '397122', '397123']
    nosy_count = 6.0
    nosy_names = ['twouters', 'brett.cannon', 'gregory.p.smith', 'ncoghlan', 'eric.snow', 'Ian.H']
    pr_nums = ['25487']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue43895'
    versions = ['Python 3.11']

    @insertinterestingnamehere
    Copy link
    Mannequin Author

    While working on another project I noticed that there's a cache of shared object handles kept inside _PyImport_FindSharedFuncptr. See

    static struct {
    dev_t dev;
    ino_t ino;
    void *handle;
    } handles[128];
    . It appears to be an optimization to work around poor caching of shared object handles in old libc implementations. After some testing, I have been unable to find any meaningful performance difference from this cache, so I propose we remove it to save the space.

    My initial tests were on Linux (Ubuntu 18.04). I saw no discernible difference in the time for running the Python test suite with a single thread. Running the test suite using a single thread shows a lot of variance, but after running with and without the cache 40 times the mean times with/without the cache was nearly the same. Interpreter startup time also appears to be unaffected. This was all with a debug build, so I'm in the process of collecting data with a release build to see if that changes anything.

    @insertinterestingnamehere insertinterestingnamehere mannequin added 3.10 only security fixes labels Apr 20, 2021
    @insertinterestingnamehere
    Copy link
    Mannequin Author

    Proposed patch is in #25487.

    @gpshead gpshead added the 3.11 only security fixes label Jul 6, 2021
    @gpshead gpshead self-assigned this Jul 6, 2021
    @gpshead gpshead added the 3.11 only security fixes label Jul 6, 2021
    @gpshead gpshead self-assigned this Jul 6, 2021
    @gpshead
    Copy link
    Member

    gpshead commented Jul 7, 2021

    New changeset fed2fc4 by Ian Henriksen in branch 'main':
    bpo-43895: Remove an unnecessary cache of shared object handles (GH-25487)
    fed2fc4

    @gpshead
    Copy link
    Member

    gpshead commented Jul 7, 2021

    Thanks Ian!

    @gpshead gpshead removed the 3.10 only security fixes label Jul 7, 2021
    @gpshead gpshead closed this as completed Jul 7, 2021
    @gpshead gpshead removed the 3.10 only security fixes label Jul 7, 2021
    @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
    3.11 only security fixes
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant