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

InTapHandler: RefusedStream may cause retrying problem #3858

Closed
menghanl opened this issue Aug 31, 2020 · 4 comments · Fixed by #4365
Closed

InTapHandler: RefusedStream may cause retrying problem #3858

menghanl opened this issue Aug 31, 2020 · 4 comments · Fixed by #4365

Comments

@menghanl
Copy link
Contributor

menghanl commented Aug 31, 2020

Currently, InTapHandler error causes a RST_STREAM with RefusedStream

s.ctx, err = t.inTapHandle(s.ctx, info)
if err != nil {
if logger.V(logLevel) {
logger.Warningf("transport: http2Server.operateHeaders got an error from InTapHandle: %v", err)
}
t.controlBuf.put(&cleanupStream{
streamID: s.id,
rst: true,
rstCode: http2.ErrCodeRefusedStream,
onWrite: func() {},
})
s.cancel()
return false
}

Since InTapHandler is mostly used for auth checking, a status with code PERMISSION_DENIED would be preferred.

We can also allow users to set the status code, if we want to keep it as a general purpose pre-message interceptor. This could get a bit tricky since InTapHandler is processed in the transport. But since status is now in its own package, this shouldn't be a problem.

@dfawley
Copy link
Member

dfawley commented Sep 22, 2020

We can also allow users to set the status code
...
But since status is now in its own package

@menghanl - What kind of status code were you thinking? We do a RST_STREAM here, so it must be an http2 error code, no? Or were you thinking this could result in trailers being sent immediately by the server?

@menghanl
Copy link
Contributor Author

I was thinking we end the stream with a gRPC status, instead of a RST_STREAM. I believe that's also what the other languages do.

@dfawley
Copy link
Member

dfawley commented Sep 22, 2020

I was thinking we end the stream with a gRPC status

So, send trailers instead of RST_STREAM? (Actually, send trailers, then still send a RST_STREAM after that since the client is presumably not half-closed yet.) That SGTM.

@easwars
Copy link
Contributor

easwars commented May 4, 2021

Moving it to @dfawley who has a PR out for this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants