GeezerVison is showing github.com — Spdy error -> Error 337 (net::ERR_SPDY_PROTOCOL_ERROR): Unknown error · Issue #442 · netty/netty
Spdy error -> Error 337 (net::ERR_SPDY_PROTOCOL_ERROR): Unknown error #442Descriptionhi,
I have added spdy support to a web server. The pipeline is fairly typical:
pipeline.addLast("decoder", new SpdyFrameDecoder(spdyVersion));
pipeline.addLast("spdy_encoder", new SpdyFrameEncoder(spdyVersion));
pipeline.addLast("spdy_session_handler", new SpdySessionHandler(spdyVersion, true));
pipeline.addLast("spdy_http_encoder", new SpdyHttpEncoder(spdyVersion));
pipeline.addLast("spdy_http_decoder", new SpdyHttpDecoder(spdyVersion, config.getMaxContentSize()));
if (config != null && config.getProcessingExecutor() != null) {
pipeline.addLast("executor", new ExecutionHandler(config.getProcessingExecutor()));
} //if
pipeline.addLast("handler", new HttpServerHandler(channelGroup, handlers));
spdyVersion is set to either 2 or 3 depending on the outcome of NPN.
Using chrome 20.0.1132.43 and netty 3.5.2.
Every once in a while chome would return the error:
Error 337 (net::ERR_SPDY_PROTOCOL_ERROR): Unknown error
Restarting chrome allows one to browse more before encountering the error again.
Switching on packet tracing in chrome results in:
t=1341569010002 [st=58620] SPDY_SESSION_SEND_RST_STREAM
--> description = "Could not parse Spdy Control Frame Header."
--> status = 1
--> stream_id = 397
This error can be triggered with and without the ExecutionHandler. Any idea where one can start looking for the problem? Activityjpinner commented on Jul 6, 2012 hexdump of the frame causing the error would be helpful
On Fri, Jul 6, 2012 at 3:17 AM, naude-r
[email protected]
wrote:
hi,
I have added spdy support to a web server. The pipeline is fairly typical:
pipeline.addLast("decoder", new SpdyFrameDecoder(spdyVersion));
pipeline.addLast("spdy_encoder", new SpdyFrameEncoder(spdyVersion));
pipeline.addLast("spdy_session_handler", new SpdySessionHandler(spdyVersion, true));
pipeline.addLast("spdy_http_encoder", new SpdyHttpEncoder(spdyVersion));
pipeline.addLast("spdy_http_decoder", new SpdyHttpDecoder(spdyVersion, config.getMaxContentSize()));
if (config != null && config.getProcessingExecutor() != null) {
pipeline.addLast("executor", new ExecutionHandler(config.getProcessingExecutor()));
} //if
pipeline.addLast("handler", new HttpServerHandler(channelGroup, handlers));
spdyVersion is set to either 2 or 3 depending on the outcome of NPN.
Using chrome 20.0.1132.43 and netty 3.5.2.
Every once in a while chome would return the error:
Error 337 (net::ERR_SPDY_PROTOCOL_ERROR): Unknown error
Restarting chrome allows one to browse more before encountering the error again.
Switching on packet tracing in chrome results in:
t=1341569010002 [st=58620] SPDY_SESSION_SEND_RST_STREAM
--> description = "Could not parse Spdy Control Frame Header."
--> status = 1
--> stream_id = 397
This error can be triggered with and without the ExecutionHandler. Any idea where one can start looking for the problem?
Reply to this email directly or view it on GitHub:
#442
naude-r commented on Jul 9, 2012 ContributorAuthor More actions jpinner commented on Jul 9, 2012 Thanks for the gist. I've figured out the error -- it's a race condition:
The responses were compressed through the SpdyFrameDecoder in this order: 1, 3, 13, 15, 11, 9, 5, 17, 19
17 was written by worker #5 and 19 was written by worker #6, however, worker #6 was able to write to the channel before worker #5 so the responses were written to the channel in this order: 1, 3, 13, 15, 11, 9, 5, 19, 17 jpinner commented on Jul 9, 2012 @trustin, @normanmaurer : how would you suggest addressing this for netty 3?
(isn't this fixed automatically in netty 4 by having the channel be single threaded in both directions?) normanmaurer commented on Jul 10, 2012 @jpinner sorry I guess you mean "SpdyFrameDecoder" right ? So you say the problem is that if you call:
channel.write(new ...);
channel.write(new ...);
its possible that the second write will be faster then first if they are executed from different threads ? Thats correct as you would need to schedule the second in a ChannelFutureListener if you want to be sure that its executed after the first. jpinner commented on Jul 10, 2012 Is that necessarily scalable? what's to prevent 3 threads from writing concurrently? or 16?
I would need each write to be enqueued on a transfer queue that synchronized with the decoder state. And a dedicated thread to read from to transfer from that queue to the channel's write queue. Is there a way to schedule execution for the channel's worker thread? normanmaurer commented on Jul 10, 2012 what you could do is this:
channel.getChannelPipeline().execute(new Runnable() {
public void run() {
channel.write(..)
}
}
This would execute the write request in the IO-Loop/Thread jpinner commented on Jul 10, 2012 thanks! :)
On Tue, Jul 10, 2012 at 12:28 AM, Norman Maurer
[email protected]
wrote:
what you could do is this:
channel.getChannelPipeline().execute(new Runnable() {
public void run() {
channel.write(..)
}
}
This would execute the write request in the IO-Loop/Thread
Reply to this email directly or view it on GitHub:
#442 (comment)
normanmaurer commented on Jul 10, 2012 I wonder if it would be a good idea todo this under-the-hood for the user. So on write it would schedule it in the event loop and so make sure that there can be no race. The downside would be that it will add some latency
@trustin wdyt ? naude-r commented on Jul 10, 2012 ContributorAuthor More actions @jpinner thank you. quickly tested the patch and everything is now working as expected. trustin commented on Jul 10, 2012 I prefer to keep the current behavior because it might affect existing applications built on top of 3. jpinner commented on Jul 10, 2012 @trustin, how so?
The sender's compression context and receiver's decompression context
must be kept in sync, so frames must be delivered to the socket in the
order they are compressed.
I think the existing race condition is a bug.
On Tue, Jul 10, 2012 at 6:02 AM, Trustin Lee
[email protected]
wrote:
I prefer to keep the current behavior because it might affect existing applications built on top of 3.
Reply to this email directly or view it on GitHub:
#442 (comment)
trustin commented on Jul 10, 2012 @jpinner I was talking about @normanmaurer 's proposal to force all downstream event invokcation to be run by an I/O thread. Your fix is great. :-)
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|