etcd icon indicating copy to clipboard operation
etcd copied to clipboard

server: don't panic in readonly serializable txn

Open lavacat opened this issue 3 years ago • 4 comments

Problem: We pass grpc context down to applier in readonly serializable txn. This context can be cancelled for example due to timeout. This will trigger panic.

Solution: provide different error handler for readonly serializable txn.

fixes https://github.com/etcd-io/etcd/issues/14110

Please read https://github.com/etcd-io/etcd/blob/main/CONTRIBUTING.md#contribution-flow.

lavacat avatar Jun 23 '22 23:06 lavacat

Please sign off the commit.

ahrtr avatar Jun 24 '22 21:06 ahrtr

Codecov Report

Merging #14149 (99f9260) into main (4977877) will decrease coverage by 0.15%. The diff coverage is 63.15%.

@@            Coverage Diff             @@
##             main   #14149      +/-   ##
==========================================
- Coverage   75.42%   75.26%   -0.16%     
==========================================
  Files         456      456              
  Lines       36919    36926       +7     
==========================================
- Hits        27846    27793      -53     
- Misses       7340     7394      +54     
- Partials     1733     1739       +6     
Flag Coverage Δ
all 75.26% <63.15%> (-0.16%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
server/etcdserver/txn/txn.go 90.11% <53.33%> (-0.56%) :arrow_down:
server/etcdserver/api/v3rpc/grpc.go 91.42% <100.00%> (ø)
server/storage/mvcc/kvstore_txn.go 79.12% <100.00%> (ø)
client/v3/namespace/watch.go 87.87% <0.00%> (-6.07%) :arrow_down:
client/v3/leasing/cache.go 87.22% <0.00%> (-4.45%) :arrow_down:
client/v3/experimental/recipes/double_barrier.go 71.87% <0.00%> (-3.13%) :arrow_down:
client/v3/retry_interceptor.go 64.54% <0.00%> (-2.73%) :arrow_down:
client/v3/concurrency/election.go 79.68% <0.00%> (-2.35%) :arrow_down:
raft/storage.go 91.66% <0.00%> (-1.86%) :arrow_down:
server/etcdserver/api/v3rpc/watch.go 86.91% <0.00%> (-1.68%) :arrow_down:
... and 11 more

Help us with your feedback. Take ten seconds to tell us how you rate us.

codecov-commenter avatar Jun 27 '22 18:06 codecov-commenter

@ahrtr @ptabor updated PR with alternative version of the test that uses reflection to check the name of the caller function and cancel context for rangeKeys. Added more comments about test setup. Addressed other small comments.

The only thing that isn't done is migration to new client interface (comment). If this approach looks good, I'll try the new client for main and keep this version for 3.5

lavacat avatar Jul 26 '22 05:07 lavacat

@ahrtr this is ready for review with unit tests instead of integration

lavacat avatar Aug 05 '22 23:08 lavacat

Thanks @spzala

Great work! @lavacat

ahrtr avatar Aug 13 '22 21:08 ahrtr