Skip to content

client/v3/watch: should panic if receives unexpected revision #20263

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fuweid
Copy link
Member

@fuweid fuweid commented Jul 1, 2025

@k8s-ci-robot
Copy link

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fuweid

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@fuweid
Copy link
Member Author

fuweid commented Jul 1, 2025

/test pull-etcd-e2e-amd64

Comment on lines 607 to 624
verify.Verify(func() {
if w.startRev > 0 {
for _, ev := range wr.Events {
if ev.Kv.ModRevision < w.startRev {
panic(fmt.Sprintf("Event.ModRevision(%d) is less than the w.startRev(%d) for watchID: %d", ev.Kv.ModRevision, w.startRev, w.id))
}
}
}
})

Copy link
Member

Choose a reason for hiding this comment

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

I strongly suggest to keep this commit in your test. So that we can exclude the server side issue. You also need to keep the field startRev in watcher

Copy link
Member Author

Choose a reason for hiding this comment

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

agree

@@ -855,6 +855,9 @@ func (w *watchGRPCStream) serveSubstream(ws *watcherStream, resumec chan struct{
nextRev = wr.Events[len(wr.Events)-1].Kv.ModRevision + 1
}

if nextRev < ws.initReq.rev {
fmt.Println("oops --------> initReq.rev(", ws.initReq.rev, ") vs nextRev(", nextRev, ")")
Copy link
Member

Choose a reason for hiding this comment

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

Please also print whether there is any Events in the watch response. If yes, print the biggest ModRevision?

Copy link
Member Author

Choose a reason for hiding this comment

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

Will update it.

@ahrtr
Copy link
Member

ahrtr commented Jul 2, 2025

Just to double check, you can only reproduce it after reverting the fix #20229? In other words, can you reproduce it without reverting the fix? The fix might be exactly the fix to both issues.

oops --------> initReq.rev( 1000 ) vs nextRev( 12 )

@fuweid
Copy link
Member Author

fuweid commented Jul 3, 2025

Just to double check, you can only reproduce it after reverting the fix #20229? In other words, can you reproduce it without reverting the fix? The fix might be exactly the fix to both issues.

Yes. With #20229, there is no progress notification received so that initReq.rev won't be decreased.

@fuweid fuweid force-pushed the reproduce-20221 branch from b7376f0 to 4d66950 Compare July 5, 2025 20:42
@k8s-ci-robot k8s-ci-robot added size/M and removed size/L labels Jul 5, 2025
@fuweid fuweid marked this pull request as ready for review July 5, 2025 20:43
@fuweid fuweid changed the title [DO_NOT_MERGE] Reproduce 20221 client/v3/watch: should panic if receives unexpected revision Jul 5, 2025
@fuweid
Copy link
Member Author

fuweid commented Jul 5, 2025

/retest

@fuweid fuweid force-pushed the reproduce-20221 branch 2 times, most recently from 8ee1ea3 to d4f8e69 Compare July 5, 2025 20:55
Copy link

codecov bot commented Jul 5, 2025

Codecov Report

Attention: Patch coverage is 55.55556% with 4 lines in your changes missing coverage. Please review.

Project coverage is 69.02%. Comparing base (f10ebf6) to head (19119ac).

Files with missing lines Patch % Lines
client/v3/watch.go 55.55% 2 Missing and 2 partials ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
client/v3/watch.go 92.74% <55.55%> (-0.50%) ⬇️

... and 22 files with indirect coverage changes

@@            Coverage Diff             @@
##             main   #20263      +/-   ##
==========================================
+ Coverage   68.72%   69.02%   +0.30%     
==========================================
  Files         413      415       +2     
  Lines       34529    34601      +72     
==========================================
+ Hits        23730    23885     +155     
+ Misses       9414     9322      -92     
- Partials     1385     1394       +9     

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f10ebf6...19119ac. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
@fuweid fuweid force-pushed the reproduce-20221 branch from d4f8e69 to 19119ac Compare July 5, 2025 21:57
@fuweid
Copy link
Member Author

fuweid commented Jul 5, 2025

/retest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants