Skip to content
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

UnicodeDecodeError: unexpected end of data in on_tracker_error_alert #7406

Closed
kozlovsky opened this issue May 8, 2023 · 1 comment
Closed
Milestone

Comments

@kozlovsky
Copy link
Contributor

Here:

    def on_tracker_error_alert(self, alert: lt.tracker_error_alert):
        self._logger.error(f'On tracker error alert: {alert}')  # <-- here

        # try-except block here is a workaround and has been added to solve
        # the issue: "UnicodeDecodeError: invalid continuation byte"
        try:
            ...

It is a regression of #5740: f-string formatting of the logging.error output should also be placed inside the following try/except block to have protection from UnicodeDecodeError.

As an additional protection, we can add a helper function like alert_to_str and use it in all places where we have {alert} formatting to be sure that all alerts can be safely converted to str

@kozlovsky kozlovsky added this to the 7.13.0 milestone May 8, 2023
@sentry-for-tribler
Copy link

Sentry issue: TRIBLER-16C

@drew2a drew2a self-assigned this May 8, 2023
@xoriole xoriole mentioned this issue May 9, 2023
@drew2a drew2a removed their assignment May 10, 2023
kozlovsky added a commit to kozlovsky/tribler that referenced this issue Jun 8, 2023
kozlovsky added a commit to kozlovsky/tribler that referenced this issue Jun 8, 2023
kozlovsky added a commit to kozlovsky/tribler that referenced this issue Jun 8, 2023
kozlovsky added a commit to kozlovsky/tribler that referenced this issue Jun 9, 2023
kozlovsky added a commit that referenced this issue Jun 9, 2023
Fixes #7406 UnicodeDecodeError in on_tracker_error_alert
@drew2a drew2a closed this as completed in 7c03858 Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants