Skip to content

Unable to use stream with STREAM_ID > 127 #223

Closed
@oleg-jukovec

Description

@oleg-jukovec

Reproducer:

func TestNewStream_Many(t *testing.T) {
	test_helpers.SkipIfStreamsUnsupported(t)

	conn := test_helpers.ConnectWithValidation(t, server, opts)
	defer conn.Close()

	for i := 0; i < 256; i++ {
		stream, _ := conn.NewStream()

		req := NewPingRequest()

		_, err := stream.Do(req).Get()
		if err != nil {
			t.Fatalf("Failed to Ping: %s", err.Error())
		}
	}
}

Result:

Failed to Ping: Invalid MsgPack - packet header (0x14)

Most likely the reason is an incorrect conversion to bytes of a stream id value:

hBytes = append(hBytes, KeyStreamId, byte(streamId))

You can compare it with the code above:

go-tarantool/connection.go

Lines 544 to 546 in 8b58928

KeySync, 0xce,
byte(reqid >> 24), byte(reqid >> 16),
byte(reqid >> 8), byte(reqid),

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomers

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions