http2: discard DATA frames with higher stream IDs during graceful shutdown

If the server sends a GOAWAY at the same time that a client sends
HEADERS+DATA, the server will discard the HEADERS, but error on the DATA
frame. Luckily, the server doesn't turn this into a connection error
because it's already in a GOAWAY state. It just logs the PROTOCOL_ERROR,
but that produces a confusing log message.

This change effectively suppresses the log message by discarding the
DATA frame rather than erroring on it. Also, we now discard any frames for
streams with identifiers higher than the identified last stream. This is
done as per section 6.8 of the HTTP2 spec.

I also updated some stale documentation while I was trying to understand
the logic.

This is CL 188360 with a test

Fixes golang/go#32112

Co-authored-by: Yunchi Luo <>
Co-authored-by: Michael Fraenkel <>

Change-Id: I612c2bd82e37551e813af0961b16a98d14e77c38
Run-TryBot: Agniva De Sarker <>
Run-TryBot: Emmanuel Odeke <>
Reviewed-by: Emmanuel Odeke <>
TryBot-Result: Go Bot <>
Trust: Damien Neil <>
2 files changed
tree: 8dc27e96f901d9a50a38b0f558eec352651ae33a
  1. .gitattributes
  2. .gitignore
  9. bpf/
  10. codereview.cfg
  11. context/
  12. dict/
  13. dns/
  14. go.mod
  15. go.sum
  16. html/
  17. http/
  18. http2/
  19. icmp/
  20. idna/
  21. internal/
  22. ipv4/
  23. ipv6/
  24. lif/
  25. nettest/
  26. netutil/
  27. proxy/
  28. publicsuffix/
  29. route/
  30. trace/
  31. webdav/
  32. websocket/
  33. xsrftoken/

Go Networking

Go Reference

This repository holds supplementary Go networking libraries.


The easiest way to install is to run go get -u You can also manually git clone the repository to $GOPATH/src/

Report Issues / Send Patches

This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see The main issue tracker for the net repository is located at Prefix your issue with “x/net:” in the subject line, so it is easy to find.