-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Protect against data race when ReverseProxy modifies response headers
See issue: golang/go#65123 ReverseProxy configures Got1xxResponse trace hook. We configure ReverseProxy with our ProxyRoundTripper. ProxyRoundTripper eventually calls http.Transport. http.Transport runs readLoop for each connection in a separate goroutine. When RoundTrip is called readLoop will run Got1xxResponse hook. If there are no errors during request handling, RoundTrip waits for readLoop to finish. If there is an error though RoundTrip exits early and does not wait for readLoop to finish. This results in readLoop goroutine running in parallel and we get a data race in our ErrorHandler which modifies response headers at the same time as Got1xxResponse hook. This error results in concurrent map writes and not panic, which is not caught by panic handler making Gorouter fail and drop all connections. This code can be removed once the ReverseProxy issue is fixed.
- Loading branch information
Showing
2 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters