GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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 #442

New issue
Copy link
New issue
Copy link
Closed
Closed
Spdy error -> Error 337 (net::ERR_SPDY_PROTOCOL_ERROR): Unknown error#442
Copy link
Assignees
jpinner
Labels
defect
Milestone
3.5.3.Final

Description

@naude-r
naude-r
opened on Jul 6, 2012
Issue body actions

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?

Activity

  1. jpinner commented on Jul 6, 2012

    @jpinner
    jpinner
    on Jul 6, 2012
    More actions

    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

  2. naude-r commented on Jul 9, 2012

    @naude-r
    naude-r
    on Jul 9, 2012
    ContributorAuthor
    More actions

    @jpinner

    have created a gist with both the hex dump (from logginghandler) and the chrome trace:
    https://gist.github.com/720271be47ffd4b54a25

    please let me know if you need anything else....

  3. jpinner commented on Jul 9, 2012

    @jpinner
    jpinner
    on Jul 9, 2012
    More actions

    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

  4. jpinner commented on Jul 9, 2012

    @jpinner
    jpinner
    on Jul 9, 2012
    More actions

    @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?)

  5. normanmaurer commented on Jul 10, 2012

    @normanmaurer
    normanmaurer
    on Jul 10, 2012
    Member
    More actions

    @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.

  6. jpinner commented on Jul 10, 2012

    @jpinner
    jpinner
    on Jul 10, 2012
    More actions

    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?

  7. normanmaurer commented on Jul 10, 2012

    @normanmaurer
    normanmaurer
    on Jul 10, 2012
    Member
    More actions

    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

  8. jpinner commented on Jul 10, 2012

    @jpinner
    jpinner
    on Jul 10, 2012
    More actions

    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)

  9. normanmaurer commented on Jul 10, 2012

    @normanmaurer
    normanmaurer
    on Jul 10, 2012
    Member
    More actions

    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 ?

  10. jpinner
    added a commit that references this issue on Jul 10, 2012

    Fix for issue netty#442: SpdyFrameEncoder compressor state race condi…

    fa4ea18
  11. naude-r commented on Jul 10, 2012

    @naude-r
    naude-r
    on Jul 10, 2012
    ContributorAuthor
    More actions

    @jpinner thank you. quickly tested the patch and everything is now working as expected.

  12. ghost assigned
    jpinner
    on Jul 10, 2012
  13. normanmaurer
    added a commit that references this issue on Jul 10, 2012

    Merge pull request #448 from jpinner/spdy_frame_encoder_race

    fbc9167
  14. normanmaurer
    closed this as completedon Jul 10, 2012
  15. trustin commented on Jul 10, 2012

    @trustin
    trustin
    on Jul 10, 2012
    Member
    More actions

    I prefer to keep the current behavior because it might affect existing applications built on top of 3.

  16. jpinner commented on Jul 10, 2012

    @jpinner
    jpinner
    on Jul 10, 2012
    More actions

    @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)

  17. trustin commented on Jul 10, 2012

    @trustin
    trustin
    on Jul 10, 2012
    Member
    More actions

    @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. :-)

  18. chrisvest
    added a commit that references this issue on Apr 2, 2025

    Fix race when offloading tasks (netty#442)

    fc07aea
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @jpinner
    jpinner

Labels

defect

Type

No type

Projects

No projects

    Milestone

    • 3.5.3.Final

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.