Skip to content

test: Temporarily work around Windows bug in walletpassphrase - #25750

Closed
maflcko wants to merge 1 commit into
bitcoin:masterfrom
maflcko:2207-windows-bad-🎀

Hidden character warning

The head ref may contain hidden characters: "2207-windows-bad-\ud83c\udf80"
Closed

maflcko wants to merge 1 commit into
bitcoin:masterfrom
maflcko:2207-windows-bad-🎀

Conversation

@maflcko

@maflcko maflcko commented Jul 30, 2022

Copy link
Copy Markdown
Member

The test passes on all platforms, such as freebsd, linux, or macos. However, it does not pass on Windows. Temporarily relax it on Windows to avoid wasting resources on manually triggered CI re-runs. The workaround can be reverted when the issue is understood and fixed.

@fanquake fanquake added the Tests label Jul 30, 2022
@DrahtBot

DrahtBot commented Jul 31, 2022 •

Copy link
Copy Markdown
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #25878 (tests: Use mocktime for wallet encryption timeout by achow101)
  • #25021 (test: fix intermittent wallet_encryption failures on win64 task by jonatack)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

# Calculate the expected timeout after the walletpassphrase call, since
# it iterates over all encrypted keys
expected_time_with_buffer = time.time() + MAX_VALUE - 600
if sys.platform == "win32":

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

From the discussion in #25482 (comment) it seems that time() and std::chrono can deviate a bit on both Windows and Linux and that is the root of the problem. We only observe a problem on Windows because it happens that Python's time.time() uses one on Windows and the other on Linux. But we are not guaranteed that it will be like that forever. E.g. future Python on Linux may start to behave as the Python on Windows.

Is the above correct? If yes, then it would be better to fix this test in platform agnostic way.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

No, I still fail to see how this bug exits in the first place.

We know:

  • It has only been observed on Windows MSVC, after commit 0000a63
  • It has never been observed on any other OS or a different compiler. Though, that doesn't mean the bug doesn't exist on Windows with clang or gcc, or on Linux with a different setting.
  • After commit 0000a63, both python time.time() and MSVC std::chrono use the same source for time (precise file time). So commit 0000a63 should have fixed the issue (if it existed before), not introduce it
  • The issue shouldn't be reproducible on systems where time() is behind std::chrono::system_clock. I've observed the time() to be behind by usually 1/2/6 ms on Linux. While this lag wouldn't lead to any test failues, commit 0000a63 removed the lag on Linux.

@ryanofsky ryanofsky left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code review ACK faa2df9. Agree with Marco it is probably good to limit the check to win32 if we don't know cause of the problem yet.

One speculation about the cause: maybe this is a rounding bug? int(time.time()) will round the expected_time_with_buffer value down in python, while it's not clear from https://en.cppreference.com/w/cpp/chrono/time_point/time_point_cast if the c++ code necessarily will truncate

@maflcko

maflcko commented Aug 19, 2022

Copy link
Copy Markdown
Member Author

One speculation about the cause: maybe this is a rounding bug?

I don't think so. floor and cast do the same thing, see #25021 (comment)

@maflcko maflcko closed this Aug 20, 2022
@maflcko
maflcko deleted the 2207-windows-bad-🎀 branch August 20, 2022 06:49
@bitcoin bitcoin locked and limited conversation to collaborators Aug 20, 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.

5 participants