-
Notifications
You must be signed in to change notification settings - Fork 450
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
Fix/stop core on components startup exception #7021
Fix/stop core on components startup exception #7021
Conversation
@@ -280,7 +280,7 @@ def event_from_exception(self, exception) -> Dict: | |||
Returns: | |||
the event that has been saved in `_before_send` method | |||
""" | |||
self._logger.info(f"Event from exception: {exception}") | |||
self._logger.debug(f"Event from exception: {exception}") |
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.
To avoid spamming logs with multiple copies of the same error traceback
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.
NIT. As an alternative option, you can use SentryReporter.ignore_logger()
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.
As I understand it, SentryReporter.ignore_logger()
affects what we send to Sentry, but does not affect our log files.
self.last_core_stdout_output: str = '' | ||
self.last_core_stderr_output: str = '' | ||
self.last_core_stdout_output: deque = deque(maxlen=CORE_OUTPUT_DEQUE_LENGTH) | ||
self.last_core_stderr_output: deque = deque(maxlen=CORE_OUTPUT_DEQUE_LENGTH) |
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.
The last write to stderr does not necessarily contain the actual exception traceback, so we store several writes.
quoted_output = re.sub(r'^', '> ', last_core_output, flags=re.MULTILINE) | ||
message += f"\n\nLast core output:\n{quoted_output}" |
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.
This PR moves the rendering of the last core output to gui_error
, as we need it not only for CoreCrashedError
but for other subclasses of CoreError as well, for example, for CoreConnectTimeoutError
.
9d8a4f7
to
a835472
Compare
@@ -280,7 +280,7 @@ def event_from_exception(self, exception) -> Dict: | |||
Returns: | |||
the event that has been saved in `_before_send` method | |||
""" | |||
self._logger.info(f"Event from exception: {exception}") | |||
self._logger.debug(f"Event from exception: {exception}") |
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.
NIT. As an alternative option, you can use SentryReporter.ignore_logger()
Fixes #7013. Stops Tribler Core on Session component's startup exception. Returns non-zero exit code from the Core process.