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

tapchannel: relax timing for quit and cancel tests #1147

Merged
merged 1 commit into from
Oct 11, 2024

Conversation

jharveyb
Copy link
Contributor

@jharveyb jharveyb commented Oct 8, 2024

Fixes #1143 . I had replicated the original failure locally, race tested this change for 100 iterations locally.

@jharveyb jharveyb self-assigned this Oct 8, 2024
@coveralls
Copy link

coveralls commented Oct 8, 2024

Pull Request Test Coverage Report for Build 11292969215

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 27 unchanged lines in 5 files lost coverage.
  • Overall coverage increased (+0.02%) to 40.402%

Files with Coverage Reduction New Missed Lines %
asset/asset.go 2 81.8%
tapgarden/caretaker.go 4 68.87%
commitment/tap.go 4 84.17%
tapdb/multiverse.go 7 60.32%
universe/interface.go 10 51.12%
Totals Coverage Status
Change from base Build 11218781069: 0.02%
Covered Lines: 24276
Relevant Lines: 60086

💛 - Coveralls

@dstadulis dstadulis added this to the v0.4.3 (temporary) milestone Oct 9, 2024
@@ -207,7 +207,7 @@ func TestAuxLeafSignerCancelAndQuit(t *testing.T) {
// Another component could have sent the cancel signal; we'll
// send that before the quit signal.
close(cancelChan)
time.Sleep(time.Millisecond)
time.Sleep(time.Microsecond * 250)
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this the opposite of "relaxing" the timing? Since this is now 0.25 milliseconds as before it was 1 millisecond?

Copy link
Contributor

Choose a reason for hiding this comment

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

What Oli says. ☝️

Copy link
Member

Choose a reason for hiding this comment

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

Can we get rid of this sleep?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The wording is sort of flipped; the 'timing' here is how long the aux signer will take to skip the remaining sig jobs.

Ideally, the last job is never processed after the quit signal is sent. I didn't account for the fact that either case of the quit-cancel switch may fire, and that jobs will get processed a lot faster once one signal is received.

After adding jobs and decreasing the timeout, I can no longer repro this flake.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can we get rid of this sleep?

Actually, yes - I think there doesn't need to be known delay between the cancel and the quit, it was a leftover from fixing the initial issue with these signals.

@jharveyb jharveyb force-pushed the aux_signer_test_race_fixes branch 2 times, most recently from 07948f3 to 4f10384 Compare October 11, 2024 10:13
Testing aux signer quit behavior involved building a job queue and then
checking that some portion of the jobs were skipped, and that the last
job was not processed. This led to racy behavior if the job queue was
too short, or the delay after sending a signal was too long. Using a
larger queue and shorter delay reduces the odds of a race here.
@jharveyb jharveyb force-pushed the aux_signer_test_race_fixes branch from 4f10384 to b6a7d60 Compare October 11, 2024 13:10
@jharveyb jharveyb added this pull request to the merge queue Oct 11, 2024
Merged via the queue into main with commit cb7520e Oct 11, 2024
18 checks passed
@guggero guggero deleted the aux_signer_test_race_fixes branch October 11, 2024 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

[bug]: unit-test TestAuxLeafSignerCancelAndQuit produces inconsistent results
7 participants