Skip to content

Conversation

katesalazar
Copy link
Contributor

This change rushes a fix for #23099.

This approach works for test/functional/test_runner.py in my system,
changes to test/fuzz/test_runner.py are untested at the time of writing
(I don't know how to run this command).

@DrahtBot DrahtBot added the Tests label Sep 26, 2021
@laanwj
Copy link
Member

laanwj commented Sep 27, 2021

Concept ACK

@meshcollider
Copy link
Contributor

meshcollider commented Oct 4, 2021

@katesalazar just a few notes:

  • Please squash your commits
  • MIN_FREE_SPACE_BEFORE_TEST is currently unused, so that needs to be corrected (unless you decide to remove it - but it think it is better to check there is enough space before starting each test, rather than checking after each).
  • I agree with Marco's comments about the 16M (and note that he is the test framework maintainer, so please do take his advice seriously 🙂)

@katesalazar
Copy link
Contributor Author

@meshcollider wrote:

  • I agree with Marco's comments about the 16M (and note that he is the test framework maintainer, so please do take his advice seriously 🙂)

Does agreeing come simply from trusting Marco, or
does it come from real positive a posteriori knowledge of the technology,
you have?

@maflcko
Copy link
Member

maflcko commented Oct 4, 2021

Again, no one asked you to trust me. Everything is in the source code, which you can read or execute yourself: #23100 (comment)

@katesalazar
Copy link
Contributor Author

You keep not proving your point,
I am not applying your suggestion myself.
It's better you commit your unproven magic numbers under your name
in a subsequent PR or an alternative PR.

@fanquake
Copy link
Member

fanquake commented Oct 5, 2021

I am not applying your suggestion myself.
It's better you commit your unproven magic numbers under your name

That's fine, you don't have to do anything you don't want to. However, this Pull Request is not going to be merged with the review comments left unaddressed, or the TODO left in the code. So you either need to address everything, or you can close this PR.

@katesalazar
Copy link
Contributor Author

katesalazar commented Oct 5, 2021

I've watched example_test.py failing to run successfully,
apparently refusing to start under ~10M free space.
It's likely I'll investigate and end up adding Marco's suggestion.

@katesalazar
Copy link
Contributor Author

See also:

constexpr uint64_t min_disk_space = 52428800; // 50 MiB

In:

bitcoin/src/util/system.cpp

Lines 144 to 150 in 9e530c6

bool CheckDiskSpace(const fs::path& dir, uint64_t additional_bytes)
{
constexpr uint64_t min_disk_space = 52428800; // 50 MiB
uint64_t free_bytes_available = fs::space(dir).available;
return free_bytes_available >= min_disk_space + additional_bytes;
}

@katesalazar
Copy link
Contributor Author

I think it can refuse to boot with 'Disk space too low' with more than
16M free, tried using 30M, it seems it refused to boot.

@katesalazar katesalazar changed the title Abort tests early upon filling the test logs drive Abort functional tests early upon low drive space Oct 5, 2021
@katesalazar katesalazar force-pushed the 20210926 branch 2 times, most recently from cd1b1dc to 471b970 Compare October 5, 2021 08:22
@@ -27,6 +27,11 @@
import logging
import unittest

# Should (in general but not always) fail testing and immediately stop if free space falls below.
# Constant value 50M comes from `bool CheckDiskSpace(2)` at
# `src/util/system.h` via uses in `src/node/blockstorage.cpp`.
Copy link
Member

Choose a reason for hiding this comment

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

Please don't put source file names / C++ implementation details here, as they are likely to just become outdated in regards to the code. Also, comments like "in general but not always" are not really useful, unless they are elaborated on (and that would be overkill here), as the reader is just left wondering about the "but not always" conditions.

@meshcollider
Copy link
Contributor

Please squash your commits again :)

It is good practice to squash after every fixup so that the PR is immediately ready to review and merge. Otherwise, squashing later will invalidate the ACKs on that commit hash.

@yanmaani
Copy link

yanmaani commented Oct 8, 2021

Conceptually it'd be cleaner if you could detect Bitcoin Core complaining about free space once and then abort the test, but I don't know if that's feasible.

@katesalazar
Copy link
Contributor Author

katesalazar commented Oct 8, 2021

It is good practice to squash after every fixup so that the PR is immediately ready to review and merge. Otherwise, squashing later will invalidate the ACKs on that commit hash.

Understood and grabbed this advice for urgent changes.
Which you won't see me taking care of in the next maybe 5 or 10 years,
for reasons.

I'll squash on demand, because that's the rules.
But squashing is a lossy* process, on Git and on GitHub, and I don't think
I should be doing it lightly.

* Let's imagine for a while the references log does not exist.

Conceptually it'd be cleaner if you could detect Bitcoin Core complaining about free space once and then abort the test, but I don't know if that's feasible.

Could spawn a thread which monitors outputs looking for "Disk space too low".
Probably that output and more cases, "No space left on drive" (IDK exactly)...

That is a great idea if a test can take a very long time to naturally abort once
is theoretically clear it will fail. I would doubt that's the case, but IDK.

@katesalazar
Copy link
Contributor Author

BTW I very much appreciate your patience with my
bi-polar bear things, thank you.

@katesalazar
Copy link
Contributor Author

dc43901
is an amend of (only) the commit message of
646029c
(which passed CI checks).

@meshcollider
Copy link
Contributor

But squashing is a lossy* process, on Git and on GitHub, and I don't think I should be doing it lightly.

You should, because in general people don't review PRs that look WIP - and unsquashed fixup commits immediately signal WIP. PRs are required to be clean and tidy for merge. There's no need to worry about loss because the new commit should always be an improvement over the old. Feel free to keep a backup of your old commits on a separate branch locally though if you want to.

@katesalazar
Copy link
Contributor Author

@meshcollider wrote:

utACK dc43901

I pushed 4b41e9d on top of dc43901.

I don't know what's the software allowing to push an
4b41e9d ACK (would that be the case) on top of an
dc43901 ACK, more importantly I don't know what's the
software allowing to automatically drafting a replay of an
4b41e9d ACK (would that be the case) on the rev
resulting from squashing 4b41e9d in dc43901.

As the code should be the same and only the commit message should
have to be reviewed, a tool should automatically draft such ACK on the
squashed rev for accelerating the review process.

If that's a manual process as I suspect, then this tool fails to provide
the features this project needs.

@fanquake
Copy link
Member

@katesalazar I don't understand your previous comment. In any case, you need to squash your commits. You should just be doing that by default.

@katesalazar
Copy link
Contributor Author

katesalazar commented Oct 19, 2021

@fanquake wrote:

I don't understand your previous comment.

Don't worry, I'm surely missing some task you do when you review.

Let's suppose there is a rev A changing 1000 lines, it's acknowledged.
A change happens and rev B has to be submitted changing 1 single line.

Submitting B on top of A is straight forward and safe.

You want me to directly push B fixed up in A, i.e. rev C, so that
C(codebase) = B(A(codebase)) = (B∘A)(codebase).

I just need you to teach me what's the command that tells you that
I didn't sneak a rogue change in C changing some 10-ish lines unexpectedly.

How do you compare A to C and get the equivalent to B without me even
ever pushing B?

@katesalazar
Copy link
Contributor Author

How do you compare A to C and get the equivalent to B without me even
ever pushing B?

Clarification,
I know git diff A C gives it; but my question is, do you really do this to
see B? Or do you just read all over all of the changes in A once again
when C is pushed?

@fanquake
Copy link
Member

You probably want git range-diff. I'd suggest reading our productivity docs.

@katesalazar
Copy link
Contributor Author

You probably want git range-diff. I'd suggest reading our productivity docs.

Oh, we stand on the shoulders of giants!

But even if range-diff works, how would you make sure that the old
feature branch tip revision (rev) isn't removed by the Git garbage
collector when you finally range-diff a feature branch tip against
the previously reviewed rev which is no longer part of a branch AKA
reference (ref)?

A reviewed rev is worth a lot more an asset than an unreviewed rev.
You would want to make sure that the garbage collector doesn't
remove a reviewed rev orphaned from a reference until the new tip
is reviewed.

Don't you need to reconfigure the references log or the garbage
collector so that they use a larger buffer or timeframe?

Or what you do is to just never update your local copy of a feature
branch ref unless you are going to review the new feature branch
tip right away, hence the previously reviewed rev orphaned from
the pull request ref becomes obsolete and discardable in the single
step of reviewing the new feature branch tip?

@maflcko
Copy link
Member

maflcko commented Oct 19, 2021

You can create a branch or tag to make sure git doesn't gc it

@katesalazar
Copy link
Contributor Author

Understood. Good enough, thanks.

@Sjors
Copy link
Member

Sjors commented Dec 9, 2021

Concept ACK. I tend to run functional tests on a RAM disk which occasionally runs out of space, resulting in weird behavior. Hopefully this PR helps.

@katesalazar
Copy link
Contributor Author

katesalazar commented Dec 10, 2021 via email

@katesalazar katesalazar marked this pull request as draft January 21, 2022 08:10
@katesalazar katesalazar force-pushed the 20210926 branch 3 times, most recently from d30a78e to 2c98a20 Compare January 21, 2022 13:30
shutil_disk_usage_stat_ = shutil.disk_usage(testdir)
try: # XXX
shutil_disk_usage_stat_ = shutil.disk_usage(testdir)
except FileNotFoundError: # XXX
Copy link
Contributor Author

Choose a reason for hiding this comment

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

have to investigate why this fixed CI

As an exception, last functional tests to be run do not impose drive
space requirements.

Some neighboring lines do not follow PEP8 strictly, so neither does
some of the lines in this change.

Includes many suggestions courtesy of MarcoFalke and fanquake and
theStack.
@fanquake
Copy link
Member

have to investigate why this fixed CI

What is the status of this? Are you still working on it? It's not mergable in it's current state.

@katesalazar
Copy link
Contributor Author

What is the status of this? Are you still working on it?

This was finished at some point, but I failed to keep up
with changes in the master branch.

It's not mergable in it's current state.

I don't have the time, hardware and drive I'd want
in order to clean this PR up (4bc38b1)
but I'm happy to let it go whenever you need so.

@fanquake
Copy link
Member

I don't have the time, hardware and drive I'd want
in order to clean this PR up

That's fine. We'll close it as "Up for Grabs".

@fanquake fanquake closed this Apr 26, 2022
@bitcoin bitcoin locked and limited conversation to collaborators Apr 26, 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.

9 participants