Skip to content

Conversation

@maflcko
Copy link
Member

@maflcko maflcko commented Jun 7, 2022

Fix the intermittent UnicodeDecodeError when the debug log is truncated on an (multi-byte) unicode character by treating everything as bytes.

Also, remove the ignore_case option and there.search+re.escape wrap. All of this is unused and doesn't exist on raw byte strings.

Fixes #24575

@bitcoin bitcoin deleted a comment Jun 7, 2022
Copy link
Member

@jonatack jonatack left a comment

Choose a reason for hiding this comment

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

ACK

@laanwj laanwj added the Tests label Jun 7, 2022
@maflcko maflcko force-pushed the 2206-test-emoji-decode- branch from faf4c03 to fa74b63 Compare June 7, 2022 18:54
@jonatack
Copy link
Member

jonatack commented Jun 8, 2022

ACK fa74b63

Copy link
Contributor

@brunoerg brunoerg left a comment

Choose a reason for hiding this comment

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

ACK fa74b63

@maflcko maflcko merged commit 455780b into bitcoin:master Jun 8, 2022
@maflcko maflcko deleted the 2206-test-emoji-decode-🎲 branch June 8, 2022 15:59
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jun 13, 2022
fa74b63 test: Fix wait_for_debug_log UnicodeDecodeError (MacroFake)

Pull request description:

  Fix the intermittent `UnicodeDecodeError` when the debug log is truncated on an (multi-byte) unicode character by treating everything as bytes.

  Also, remove the `ignore_case` option and the`re.search+re.escape` wrap. All of this is unused and doesn't exist on raw byte strings.

  Fixes bitcoin#24575

ACKs for top commit:
  jonatack:
    ACK fa74b63
  brunoerg:
    ACK fa74b63

Tree-SHA512: c67c9355073e784fa8d9d48b8e79ff0c98f5ae9cd4d704ad12a76d2604733946054bc74b8ab346aa2184db23d740b85c8c13eb892d76cba92e42ebfd73f2f1bf
@PiRK
Copy link
Contributor

PiRK commented Nov 25, 2022

@MarcoFalke I think line 451 of test_node.py is now broken. log is now no longer a string, but bytes.

            if time.time() >= time_end:
                print_log = " - " + "\n - ".join(log.splitlines())
                break

mypy detected this when I tried adding a typehint (List[bytes]) to the expected_msgs parameter of wait_for_debug_log.

This could work

            if time.time() >= time_end:
                print_log = " - " + "\n - ".join([f"\n - {line.decode()}" for line in log.splitlines()])
                break

Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Nov 25, 2022
Summary:
> Fix the intermittent UnicodeDecodeError when the debug log is truncated on an (multi-byte) unicode character by treating everything as bytes.
>
> Also, remove the ignore_case option and there.search+re.escape wrap. All of this is unused and doesn't exist on raw byte strings.

This is a backport of [[bitcoin/bitcoin#25294 | core#25294]]

Depends on D12622

Note:
I added a typehint for `expected_msgs` because imo the parameter name is now misleading with regards to its type. This allowed the mypy linter to detect that a subsequent line defining `print_log` is now broken because `log` is now of type `bytes` and you cannot join `bytes` with `str`

Test Plan: `ninja check-functional`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D12624
@bitcoin bitcoin locked and limited conversation to collaborators Nov 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feature_init intermittent issue: UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 1215-1217: unexpected end of data

5 participants