Skip to content

calling conn close before stream close results in a soft deadlock #24

@erikh

Description

@erikh
        conn, dialErr := net.Dial("tcp", LISTEN_ADDRESS)
        if dialErr != nil {
            b.Fatalf("Error dialing server: %s", dialErr)
        }

        spdyConn, spdyErr := NewConnection(conn, false)
        if spdyErr != nil {
            b.Fatalf("Error creating spdy connection: %s", spdyErr)
        }

        go spdyConn.Serve(MirrorStreamHandler)

        stream, err := spdyConn.CreateStream(http.Header{}, nil, false)

        writer := make([]byte, 1024)

        stream.Write(writer)

        if err != nil {
            panic(err)
        }

        reader := make([]byte, 1024)
        stream.Read(reader)

        closeErr := spdyConn.Close()
        if closeErr != nil {
            b.Fatalf("Error closing connection: %s, closeErr")
        }

This code should soft deadlock, or at least, that's what I was seeing in the runs I made.

if you add a stream.Close() after the stream.Read() call, it exhibits the desired behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions