grpc-go icon indicating copy to clipboard operation
grpc-go copied to clipboard

test: add test for invalid streamID

Open AnandInguva opened this issue 5 months ago • 6 comments

Fixes: https://github.com/grpc/grpc-go/issues/104

RELEASE NOTES: none

AnandInguva avatar Jan 24 '24 03:01 AnandInguva

CLA Signed

The committers listed above are authorized under a signed CLA.

  • :white_check_mark: login: AnandInguva / name: Anand Inguva (577a1b72b770bb526157b7f5e49eafef5ace22c6, 4300406e7b93fea5b9d67dbef48482f30cd1e9cc, bee70038331f8510381809910d28250109613266, ac91174398206e0151680b276f76fbb8500f26a9, 6b1329718aa2b5edc94cb65304484df6d61424eb, 71b7ee758d3e7dd430aa0de7ae726b419bfb68df, 7a1a6f873a6018f9273f278d49065b01ebd4dc32, 24816f2ae434a2ab4efdce6ebe618b0cb8e16a6b, 14ecbb8a0218f1978666d47e76b86e7b61ae0f8f, 43387892d813b0684dba5efcc96c1184f70722b9, 5fff887f2b2ccbdca62843119272c5a8966fde84, 9815dbc07b43c1ce30f3ef714b822999512dee70, 3bd77dfbd34d9609066384462aa2a3f6479f5cd6, 3e863dec6f6554ad91d54b2edd54c19901667f43, 34dd481dd287a221eb2570f672c0a2a6ff70a1df, cfa206baa3ce147389dfc46c2fcc6dbc8c5a7b09, 26c215bb87427aa006626eaf26bb5bc916a12089, fcff4039fbd3c74da9624813f2688fd68d5eb8d8, 4d3bc7221415b4bfb1aaf1f56564ad57dd880209, ad742c38b3b7d514970911f882a7354832f40a4f, c68ded336de9f649e2877b76a10392bcf077c3d5, f1855d3825b582b68644ad01dada38e58537afb1, f25503b0598c48899acf1f4149c6d2f48e307b22, a1d33da242faf2a18221cfbbd8fcc56b30f3f4de, 3522f843e70d7a608eddfadee1b907fcc2ca179c, fa6121530a39936757c9ffede15180e3c09c4184, 6b791101c0501c80c76014a88b2d8473dabd4117, 7bbea1f559ce8a826cd8ed9c24e07e8a9889dbd0)

Codecov Report

Merging #6940 (3522f84) into master (d41b01d) will decrease coverage by 0.20%. Report is 11 commits behind head on master. The diff coverage is 62.50%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6940      +/-   ##
==========================================
- Coverage   82.62%   82.42%   -0.20%     
==========================================
  Files         296      296              
  Lines       31432    31461      +29     
==========================================
- Hits        25970    25933      -37     
- Misses       4422     4469      +47     
- Partials     1040     1059      +19     
Files Coverage Δ
internal/transport/http2_server.go 90.70% <62.50%> (+<0.01%) :arrow_up:

... and 27 files with indirect coverage changes

codecov[bot] avatar Jan 24 '24 03:01 codecov[bot]

@dfawley @arvindbr8 can you suggest how could i assert/verify the error?

AnandInguva avatar Jan 24 '24 16:01 AnandInguva

@AnandInguva - Sure, taking a look

arvindbr8 avatar Jan 24 '24 17:01 arvindbr8

Yeah, let me make some changes soon

AnandInguva avatar Jan 26 '24 02:01 AnandInguva

I think we missed a small excerpt from the HTTP2 spec --

An endpoint that receives an unexpected stream identifier MUST respond with a connection error (Section 5.4.1) of type PROTOCOL_ERROR.

Right now when operateHeaders returns with an error the transport calls Close on itself (also note that the only error returned by operateHeaders is in the same invalid stream ID scenario). We should instead put a GOAWAY into the controlbuf and just continue the loop in HandleStreams. The GOAWAY should have the error code PROTOCOL_ERROR and also should close the connection. Since the connection is now closed, the next iteration in HandleStreams would then error when reading the frame and close the transport.

By doing this, we should be able to use just the end2end test and assert that the server returns a GOAWAY frame with the error message.

Let's please add that as part of this fix.

I made changes according to this. PTAL.

AnandInguva avatar Feb 08 '24 16:02 AnandInguva