Home / Function/ onStreamError() — netty Function Reference

onStreamError() — netty Function Reference

Architecture documentation for the onStreamError() function in Http2ConnectionHandler.java from the netty codebase.

Function java Buffer Allocators calls 2 called by 1

Entity Profile

Dependency Diagram

graph TD
  6c95a5e1_2ed4_8756_7e89_fed3811df965["onStreamError()"]
  a9ab361d_2417_0366_d9d0_ae1adb2145dc["Http2ConnectionHandler"]
  6c95a5e1_2ed4_8756_7e89_fed3811df965 -->|defined in| a9ab361d_2417_0366_d9d0_ae1adb2145dc
  c019b218_592f_da69_100d_79381ffa0e04["onError()"]
  c019b218_592f_da69_100d_79381ffa0e04 -->|calls| 6c95a5e1_2ed4_8756_7e89_fed3811df965
  1e099b8f_ff38_6e58_8f39_c975ea3ec6a3["handleServerHeaderDecodeSizeError()"]
  6c95a5e1_2ed4_8756_7e89_fed3811df965 -->|calls| 1e099b8f_ff38_6e58_8f39_c975ea3ec6a3
  c019b218_592f_da69_100d_79381ffa0e04["onError()"]
  6c95a5e1_2ed4_8756_7e89_fed3811df965 -->|calls| c019b218_592f_da69_100d_79381ffa0e04
  style 6c95a5e1_2ed4_8756_7e89_fed3811df965 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java lines 701–743

    protected void onStreamError(ChannelHandlerContext ctx, boolean outbound,
                                 @SuppressWarnings("unused") Throwable cause, StreamException http2Ex) {
        final int streamId = http2Ex.streamId();
        Http2Stream stream = connection().stream(streamId);

        //if this is caused by reading headers that are too large, send a header with status 431
        if (http2Ex instanceof Http2Exception.HeaderListSizeException &&
            ((Http2Exception.HeaderListSizeException) http2Ex).duringDecode() &&
            connection().isServer()) {

            // NOTE We have to check to make sure that a stream exists before we send our reply.
            // We likely always create the stream below as the stream isn't created until the
            // header block is completely processed.

            // The case of a streamId referring to a stream which was already closed is handled
            // by createStream and will land us in the catch block below
            if (stream == null) {
                try {
                    stream = encoder.connection().remote().createStream(streamId, true);
                } catch (Http2Exception e) {
                    encoder().writeRstStream(ctx, streamId, http2Ex.error().code(), ctx.newPromise());
                    return;
                }
            }

            // ensure that we have not already sent headers on this stream
            if (stream != null && !stream.isHeadersSent()) {
                try {
                    handleServerHeaderDecodeSizeError(ctx, stream);
                } catch (Throwable cause2) {
                    onError(ctx, outbound, connectionError(INTERNAL_ERROR, cause2, "Error DecodeSizeError"));
                }
            }
        }

        if (stream == null) {
            if (!outbound || connection().local().mayHaveCreatedStream(streamId)) {
                encoder().writeRstStream(ctx, streamId, http2Ex.error().code(), ctx.newPromise());
            }
        } else {
            encoder().writeRstStream(ctx, streamId, http2Ex.error().code(), ctx.newPromise());
        }
    }

Domain

Subdomains

Called By

Frequently Asked Questions

What does onStreamError() do?
onStreamError() is a function in the netty codebase, defined in codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java.
Where is onStreamError() defined?
onStreamError() is defined in codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java at line 701.
What does onStreamError() call?
onStreamError() calls 2 function(s): handleServerHeaderDecodeSizeError, onError.
What calls onStreamError()?
onStreamError() is called by 1 function(s): onError.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free