rohanpm / more-executors

Library of composable Python executors

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rethink "exception calling callback for %r"

rohanpm opened this issue · comments

I have observed the following crash:

  File "/usr/lib/python2.6/site-packages/more_executors/_impl/common.py", line 42, in _me_invoke_callbacks
    LOG.exception("exception calling callback for %r", self)
...
  File "/usr/lib64/python2.6/logging/__init__.py", line 162, in getLevelName
    return _levelNames.get(level, ("Level %s" % level))
RuntimeError: maximum recursion depth exceeded while getting the str of an object

It would appear as though converting self to str might be able to blow the stack here, in at least some cases.

I think the representation of "self" here is not going to be useful anyway, so consider maybe dropping it. However this might incidentally be fixed by #312 .

Dropping this after confirming that:

  • concurrent.futures logs in exactly the same way (I've presumably copy-pasted it from there).
  • repr on Future should be reasonably safe as it only logs the type of the result, not str or repr of the result itself

The root cause of the above crash can't be pinned on this logging.