race condition in http/2 around connection preface
See original GitHub issueExpected behavior
h2 clients should buffer messages until after the connection preface has been sent
Actual behavior
h2 will try to write http/2 frames before writing the connection preface.
Steps to reproduce
Construct a netty pipeline, add an http2connectionhandler, call connect, then immediately try writing an http/2 message.
Minimal yet complete reproducer code (or URL to code)
Remove this line: https://github.com/twitter/finagle/blob/develop/finagle-http2/src/main/scala/com/twitter/finagle/http2/Http2Transporter.scala#L113 and then try running our test suite.
https://github.com/twitter/finagle
Netty version
4.1.7 (goes back as far as 4.1.0, I think)
JVM version (e.g. java -version
)
8
OS version (e.g. uname -a
)
Darwin tw-172-25-138-25.office.twttr.net 14.5.0 Darwin Kernel Version 14.5.0: Sun Sep 25 22:07:15 PDT 2016; root:xnu-2782.50.9~1/RELEASE_X86_64 x86_64
Issue Analytics
- State:
- Created 7 years ago
- Comments:12 (12 by maintainers)
Top Results From Across the Web
Possible race condition with http2 · Issue #2469 · square/okhttp
It looks like the server is sending the SETTINGS frame before we have time to send the connection preface. We ACK the settings...
Read more >Exploiting Race Conditions in Web Applications ... - NTNU Open
Race conditions can occur in web applications if several threads, ... parallel requests over a single TCP connection, making race condition.
Read more >Possible race condition With http2 implementation
I have a curious issue, which happens in production very infrequently. I have a gobal http client to reuse connections.
Read more >Race Condition in Web Applications - Wallarm
The race condition occurs both in multithreaded applications and in the databases in which they work. Read all the details in our article....
Read more >What is a Race Condition? - TechTarget
In a network, a race condition may occur if two users try to access a channel at the same instant and neither computer...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
OK, this isn’t high priority for us, since we have something working, but I’ll see if I can schedule some time for a PR for this.
@Scottmitch I almost forgot–the reason I filed this ticket was because I found that it wasn’t always triggered on channelActive, so right now I have to try to guess when the preface will be sent. As an example, if I’m using ALPN to decide whether to install the http/2 connection handler or not, when I add the handler, channelActive has already been triggered, so instead it sends the connection preface on handlerAdded. This means I need a different buffering handler depending upon how it’s added to the pipeline.