-
Notifications
You must be signed in to change notification settings - Fork 68
Closed
Labels
🚨This issue needs some love.This issue needs some love.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.Important issue which blocks shipping the next release. Will be fixed prior to next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
i saw a handful of these recently during a spike of traffic. prod GAE, python 3.7 runtime, ndb v1.1.1, but looking at the ndb code, i suspect it's still there in head. full stack trace below; more details afterward. also my app's code is open source; here's the app.py line in the stack trace.
Traceback (most recent call last):
...
File "/srv/app.py", line 567, in post
self.setup_refetch_hfeed()
File "/env/lib/python3.7/site-packages/google/cloud/ndb/_transaction.py", line 191, in transactional_inner_wrapper
propagation=propagation,
File "/env/lib/python3.7/site-packages/google/cloud/ndb/_transaction.py", line 72, in transaction
return future.result()
File "/env/lib/python3.7/site-packages/google/cloud/ndb/tasklets.py", line 190, in result
self.check_success()
File "/env/lib/python3.7/site-packages/google/cloud/ndb/tasklets.py", line 137, in check_success
raise self._exception
File "/env/lib/python3.7/site-packages/google/cloud/ndb/tasklets.py", line 309, in _advance_tasklet
self.generator.throw(type(error), error, traceback)
File "/env/lib/python3.7/site-packages/google/cloud/ndb/_retry.py", line 77, in retry_wrapper
if not is_transient_error(error):
File "/env/lib/python3.7/site-packages/google/cloud/ndb/_retry.py", line 120, in is_transient_error
code = method()
TypeError: 'int' object is not callable
looking at _retry.is_transient_error(), it assumes that the raised exception's code attribute is a method:
python-ndb/google/cloud/ndb/_retry.py
Lines 118 to 120 in a3f2fb5
| method = getattr(error, "code", None) | |
| if method is not None: | |
| code = method() |
...but some exceptions have it as a plain attribute instead, eg urllib.error.HTTPError, which my code does raise occasionally, and might be the culprit here. maybe expand the check to if method is not None and callable(method):?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
🚨This issue needs some love.This issue needs some love.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.Important issue which blocks shipping the next release. Will be fixed prior to next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.