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

Intermittent AttributeError when using time.strptime in threads #55317

Closed
ccorbacho mannequin opened this issue Feb 3, 2011 · 2 comments
Closed

Intermittent AttributeError when using time.strptime in threads #55317

ccorbacho mannequin opened this issue Feb 3, 2011 · 2 comments
Labels
type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@ccorbacho
Copy link
Mannequin

ccorbacho mannequin commented Feb 3, 2011

BPO 11108
Nosy @amauryfa, @florentx
Superseder
  • bpo-7980: time.strptime not thread safe
  • Files
  • test_time.py: Threading code example
  • 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 2011-02-04.00:27:14.548>
    created_at = <Date 2011-02-03.21:08:06.668>
    labels = ['type-crash']
    title = 'Intermittent AttributeError when using time.strptime in threads'
    updated_at = <Date 2012-01-19.07:23:42.306>
    user = 'https://bugs.python.org/ccorbacho'

    bugs.python.org fields:

    activity = <Date 2012-01-19.07:23:42.306>
    actor = 'flox'
    assignee = 'none'
    closed = True
    closed_date = <Date 2011-02-04.00:27:14.548>
    closer = 'amaury.forgeotdarc'
    components = ['None']
    creation = <Date 2011-02-03.21:08:06.668>
    creator = 'ccorbacho'
    dependencies = []
    files = ['20664']
    hgrepos = []
    issue_num = 11108
    keywords = []
    message_count = 2.0
    messages = ['127822', '127839']
    nosy_count = 3.0
    nosy_names = ['amaury.forgeotdarc', 'flox', 'ccorbacho']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = None
    status = 'closed'
    superseder = '7980'
    type = 'crash'
    url = 'https://bugs.python.org/issue11108'
    versions = ['Python 2.6']

    @ccorbacho
    Copy link
    Mannequin Author

    ccorbacho mannequin commented Feb 3, 2011

    time.strptime() intermittently (and I mean _really_ intermittently) throws an AttributeError.

    Steps to reproduce:

    Run the attached script (you may have to do this quite a lot of times; in an evening of trying, I could only trigger this bug once...) - this just starts lots of threads so that we have lots of time.strptime()'s running in parallel.

    Expected:

    It just keeps running every time.

    Actual:

    On one run, the script bailed out almost immediately -

    ccorbacho@valkyrie:~/chroots/trunk/home/ccorbacho/scratch/ccorbacho$ python test_time.py
    Exception in thread Thread-2:
    Traceback (most recent call last):
      File "/usr/lib64/python2.6/threading.py", line 532, in __bootstrap_inner
        self.run()
      File "test_time.py", line 13, in run
        time.strptime("30 Nov 00", "%d %b %y")
    AttributeError: _strptime_time

    This is with Python 2.6.6. However, at work we have been seeing this very intermittently with Python 2.5 in threaded code doing time.strptime() as well (though we just get AttributeError: strptime, but I don't have any code I can provide to reproduce on 2.5), hence I'm raising the bug.

    @ccorbacho ccorbacho mannequin added the type-crash A hard crash of the interpreter, possibly with a core dump label Feb 3, 2011
    @amauryfa
    Copy link
    Member

    amauryfa commented Feb 4, 2011

    It's a duplicate of bpo-7980.
    One workaround is to call strptime() once in the main thread.

    @amauryfa amauryfa closed this as completed Feb 4, 2011
    @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
    type-crash A hard crash of the interpreter, possibly with a core dump
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant