Handle "log gone" (PYTHON-1266) at the end of _run_loop#1133
Conversation
If log is somehow gone and file exception due to the race mention in PYTHON-1266 it will also inevitably fail for the same reason after the loop so we need to catch the exception there as well.
There was a problem hiding this comment.
Given that this verbiage is already used for the existing logging try/catch in this method we're starting to get into some ugly duplication here. Prolly worth pulling this out into a function, something like:
def maybe_log_debug(*args, **kwargs)
try:
log.debug(*args, **kwargs)
except Exception:
# TODO: Remove when Python 2 support is removed
# PYTHON-1266. If our logger has disappeared, there's nothing we
# can do, so just log nothing.
passand then call with appropriate params.
This is a relatively minor thing so I can prolly also just clean it up after this gets merged if you don't wanna muck with it @tlasica. Either way is good with me!
There was a problem hiding this comment.
I was thinking about it, but I decided not to do it:
- there are 2 occurences, my rule of thumb is 3
- all are local in the same function
TLDR I think it is not worth it.
There was a problem hiding this comment.
No worries, I can take care of it. Thanks for the fix @tlasica!
|
Perhaps it is prudent to gateway language version sensitive areas of the code using the factory pattern. This would save adding many if and try statements downstream. |
version 3.26.0 * tag '3.26.0' of https://github.com/datastax/python-driver: (22 commits) Release 3.26: changelog & version Going back to known good non-2.7 PyPy target. PYTHON-1333 has more detail. Forgot to add complete extension Trying to get to a maximal working Pypy version. Have to go back to 3.6 which isn't ideal... Update Travis config to only run versions that will be supported going forward Minor refactor of prior commit: now that we're dropping 2.7.x support we don't really need to leverage six for unit test functions. Remove references to unsupported Python versions from setup.py Refactor deprecated unittest aliases for Python 3.11 compatibility. (apache#1112) Merge pull request apache#1140 from python-driver/python-1327 Merge pull request apache#1139 from python-driver/python-1328 Merge pull request apache#1137 from python-driver/python-1329 Merge pull request apache#1128 from python-driver/python-1304 Fix jenkins builds (apache#1134) Minor refactor of prior commit Handle "log gone" case in the end of _run_loop (apache#1133) HostFilterPolicyInitTest fix for Python 3.11 (apache#1131) Groovy fixes Hey, let's actually update the right things, shall we? Smaller smoke test configuration to avoid explosion of test builds in AWS Fix to prior fix ...
version 3.26.0 * tag '3.26.0' of https://github.com/datastax/python-driver: (22 commits) Release 3.26: changelog & version Going back to known good non-2.7 PyPy target. PYTHON-1333 has more detail. Forgot to add complete extension Trying to get to a maximal working Pypy version. Have to go back to 3.6 which isn't ideal... Update Travis config to only run versions that will be supported going forward Minor refactor of prior commit: now that we're dropping 2.7.x support we don't really need to leverage six for unit test functions. Remove references to unsupported Python versions from setup.py Refactor deprecated unittest aliases for Python 3.11 compatibility. (apache#1112) Merge pull request apache#1140 from python-driver/python-1327 Merge pull request apache#1139 from python-driver/python-1328 Merge pull request apache#1137 from python-driver/python-1329 Merge pull request apache#1128 from python-driver/python-1304 Fix jenkins builds (apache#1134) Minor refactor of prior commit Handle "log gone" case in the end of _run_loop (apache#1133) HostFilterPolicyInitTest fix for Python 3.11 (apache#1131) Groovy fixes Hey, let's actually update the right things, shall we? Smaller smoke test configuration to avoid explosion of test builds in AWS Fix to prior fix ...

If log is somehow gone and file exception due to the race mention in PYTHON-1266 it will also inevitably fail for the same reason after the loop so we need to catch the exception there as well.
I have hit it in some Cassandra dtest: