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

regrtest.py: spurious leaks with -R option #59837

Closed
skrah mannequin opened this issue Aug 12, 2012 · 5 comments
Closed

regrtest.py: spurious leaks with -R option #59837

skrah mannequin opened this issue Aug 12, 2012 · 5 comments
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@skrah
Copy link
Mannequin

skrah mannequin commented Aug 12, 2012

BPO 15632
Nosy @skrah, @meadori
Files
  • warm_latin1_cache.diff
  • test_pseudo_leak.py
  • issue15632.diff
  • 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 2012-08-17.21:14:37.912>
    created_at = <Date 2012-08-12.19:31:45.980>
    labels = ['type-bug', 'tests']
    title = 'regrtest.py: spurious leaks with -R option'
    updated_at = <Date 2012-08-17.21:14:37.910>
    user = 'https://github.com/skrah'

    bugs.python.org fields:

    activity = <Date 2012-08-17.21:14:37.910>
    actor = 'python-dev'
    assignee = 'none'
    closed = True
    closed_date = <Date 2012-08-17.21:14:37.912>
    closer = 'python-dev'
    components = ['Tests']
    creation = <Date 2012-08-12.19:31:45.980>
    creator = 'skrah'
    dependencies = []
    files = ['26777', '26778', '26798']
    hgrepos = []
    issue_num = 15632
    keywords = ['patch']
    message_count = 5.0
    messages = ['168063', '168065', '168066', '168182', '168479']
    nosy_count = 3.0
    nosy_names = ['skrah', 'meador.inge', 'python-dev']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue15632'
    versions = ['Python 3.2', 'Python 3.3']

    @skrah
    Copy link
    Mannequin Author

    skrah mannequin commented Aug 12, 2012

    With the -R option, test_buffer.py needs an additional warm-up for
    the unicode_latin1 cache. Patch attached.

    @skrah skrah mannequin added tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error labels Aug 12, 2012
    @meadori
    Copy link
    Member

    meadori commented Aug 12, 2012

    I know the title says spurious, but is there a way to reproduce this at all? Can I run a certain suite N times or something? How did you find the problem?

    @skrah
    Copy link
    Mannequin Author

    skrah mannequin commented Aug 12, 2012

    I'm attaching a test case. You're right, in test_buffer it's
    hard to reproduce but I've encountered the "leak" several times
    in the past months.

    Today I realized that the "leak" always occurred with format code
    'c'. There's this passage in test_buffer:

        x = randrange(*fmtdict[mode][char])
        if char == 'c':
            x = bytes(chr(x), 'latin1')

    After some head scratching I looked into regrtest.py and found
    the warm_char_cache() function. The whole thing makes sense: In
    each repetition of the refleak mode new characters can be added
    to the unicode_latin1 cache.

    So, you should be able to reproduce the issue:

    $ ./python -m test -uall -R 2:2 test_pseudo_leak
    [1/1] test_pseudo_leak
    beginning 4 repetitions
    1234
    ....
    test_pseudo_leak leaked [8, 8] references, sum=16
    1 test failed:
        test_pseudo_leak
    [151225 refs]

    @skrah
    Copy link
    Mannequin Author

    skrah mannequin commented Aug 14, 2012

    Should we go all the way and also explicitly fill the small int cache?

    Integers 0-255 should be initialized already, but I'm not sure
    about [-5..-1] and 256. I haven't been able to create a test case
    for integers though.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Aug 17, 2012

    New changeset dc18d73e67a5 by Stefan Krah in branch 'default':
    Closes bpo-15632: regrtest.py: fix spurious refleaks due to various caches
    http://hg.python.org/cpython/rev/dc18d73e67a5

    @python-dev python-dev mannequin closed this as completed Aug 17, 2012
    @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
    tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant