Skip to content
This repository has been archived by the owner on Apr 22, 2020. It is now read-only.

concurrency: fix multiexception rendering to include timestamp and context; add timestamp exceptions if concurrent #68

Merged
merged 1 commit into from
Apr 15, 2018

Conversation

koreno
Copy link
Contributor

@koreno koreno commented Apr 15, 2018

There's a bunch of code duplication here, but it's too much to refactor at this stage. In other words, we're looking for bugs, not so much for code elegance...

…ntext; add timestamp exceptions if concurrent
for exc in self.actual:
with buff.indent("{.__class__.__qualname__}", exc):
if isinstance(exc, self.__class__):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This is actually a bug now that MultiException subtyping is in...)

@@ -343,15 +360,16 @@ def logged_wait(self, timeout=None, initial_log_interval=None):


def _run_with_exception_logging(func, args, kwargs, ctx):
ctx.update(threadname=threading.current_thread().name)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ctx['threadname'] = threading.current_thread().name

(yea, I know it's unrefactored code, but there is no reason not to use the conventional style here...)

@@ -936,6 +954,10 @@ def _logged_func(self):
except Exception as exc:
_logger.silent_exception("Exception in thread running %s (traceback can be found in debug-level logs)", self.func)
self.exc = exc
try:
exc.timestamp = time.time()
except Exception:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What kind of Exception are we expecting here?

Copy link
Contributor Author

@koreno koreno Apr 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if exc happens to have __slots__ or some __setattribute__ or a read-only timestamp property it might not allow arbitrary attribute assignment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And we don't want a more specific exception? Or we just don't want to take the chance an exception logging related code will fail?

@koreno koreno merged commit 134a197 into master Apr 15, 2018
@YuvalEvron YuvalEvron deleted the multiexception-rendering-fix branch August 6, 2019 08:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants