libearth.codecs throws AttributeError #32

Closed
summerlight opened this Issue Dec 25, 2013 · 0 comments

Comments

Projects
None yet
2 participants
@summerlight

Concurrent, multiple threads that handle rss responses may raise AttritubeError. Below is the stack trace.

Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\flask\app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "C:\Python27\lib\site-packages\earthreader\web\wsgi.py", line 59, in __ca
ll__
    return self.app(environ, start_response)
  File "C:\Python27\lib\site-packages\flask\app.py", line 1820, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "C:\Python27\lib\site-packages\flask\app.py", line 1403, in handle_except
ion
    reraise(exc_type, exc_value, tb)
  File "C:\Python27\lib\site-packages\flask\app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\Python27\lib\site-packages\flask\app.py", line 1477, in full_dispatch
_request
    rv = self.handle_user_exception(e)
  File "C:\Python27\lib\site-packages\flask\app.py", line 1381, in handle_user_e
xception
    reraise(exc_type, exc_value, tb)
  File "C:\Python27\lib\site-packages\flask\app.py", line 1475, in full_dispatch
_request
    rv = self.dispatch_request()
  File "C:\Python27\lib\site-packages\flask\app.py", line 1461, in dispatch_requ
est
    return self.view_functions[rule.endpoint](**req.view_args)
  File "C:\Python27\lib\site-packages\earthreader\web\app.py", line 249, in feed
s
    cursor = Cursor(category_id)
  File "C:\Python27\lib\site-packages\earthreader\web\app.py", line 133, in __in
it__
    self.subscriptionlist = (stage.subscriptions if stage.subscriptions
  File "C:\Python27\lib\site-packages\libearth\stage.py", line 610, in __get__
    return obj.read_merged_document(self.document_type, self.key_spec, key)
  File "C:\Python27\lib\site-packages\libearth\stage.py", line 273, in read_merg
ed_document
    doc = self.read(document_type, k)
  File "C:\Python27\lib\site-packages\libearth\stage.py", line 250, in read
    document = read(document_type, chunks)
  File "C:\Python27\lib\site-packages\libearth\schema.py", line 1667, in read
    if not doc._parse_next():
  File "C:\Python27\lib\site-packages\libearth\schema.py", line 1010, in _parse_
next
    parser.feed(chunk)
  File "C:\Python27\lib\xml\sax\expatreader.py", line 207, in feed
    self._parser.Parse(data, isFinal)
  File "C:\Python27\lib\xml\sax\expatreader.py", line 338, in start_element_ns
    AttributesNSImpl(newattrs, qnames))
  File "C:\Python27\lib\site-packages\libearth\schema.py", line 1385, in startEl
ementNS
    instance
  File "C:\Python27\lib\site-packages\libearth\schema.py", line 659, in decode
    text = decoder.function(text)
  File "C:\Python27\lib\site-packages\libearth\codecs.py", line 230, in decode
    res = datetime.datetime.strptime(timestamp, '%d %b %Y %H:%M:%S')
AttributeError: _strptime

Below link suggests that python implementation on windows has thread-safety bug on strptime initialization. I guess that those issues can also be related to this bug.

http://stackoverflow.com/questions/2427240/thread-safe-equivalent-to-pythons-time-strptime
http://bugs.python.org/issue7980

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment