-
Notifications
You must be signed in to change notification settings - Fork 685
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
trinity: Proxied services now record remote exceptions' tracebacks #1004
Conversation
trinity/chains/__init__.py
Outdated
@@ -144,6 +148,33 @@ def initialize_database(chain_config: ChainConfig, chaindb: AsyncChainDB) -> Non | |||
) | |||
|
|||
|
|||
class TracebackKeeper: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
naming nitpick
maybe TracebackPreserver
or TracebackRecorder
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 on TracebackRecorder
trinity/chains/__init__.py
Outdated
if not inspect.ismethod(attr): | ||
return attr | ||
|
||
def wrapper(*args: Any, **kwargs: Any) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe lift this out of the function body to the top level of the module and then this function body would be
if not inspect.ismethod(attr):
return attr
else:
return record_traceback_on_error(attr)
I've improved this a bit based on this trick It uses exception chaining, which means we don't need any extra hacks to special case the logging of those exceptions. This is how it looks like:
|
The remote exception's traceback is then chained with the exception instance sent to the main process, giving us a traceback containing the stack frames that led to the exception in both processes. Closes: ethereum#956
Closes: #956