liftbridge-io / liftbridge

Lightweight, fault-tolerant message streams.
https://liftbridge.io
Apache License 2.0
2.57k stars 107 forks source link

Server crash on subscribe #142

Closed caioaao closed 4 years ago

caioaao commented 4 years ago

I couldn't pinpoint what in my code is causing it, but the code is in this commit at the java client: https://github.com/caioaao/java-liftbridge/tree/9618eef917fa34224ae907fc006e7787d4d650e0

The test that causes the crash is this: https://github.com/caioaao/java-liftbridge/blob/9618eef917fa34224ae907fc006e7787d4d650e0/src/test/java/io/liftbridge/ClientSubscribeTest.java#L56-L76

When this test runs, the server outputs this and then crashes:

time="2019-12-23 22:47:57" level=error msg="api: Failed to subscribe to partition [stream=BxaMlxKMcHmamFU, partition=0]: no such partition"
time="2019-12-23 22:47:58" level=error msg="api: Failed to subscribe to partition [stream=QqcpyxpkVcVvZph, partition=0]: no such partition"
time="2019-12-23 22:48:53" level=error msg="api: Failed to subscribe to partition [stream=TYWmpjmwKTXbsdL, partition=0]: no such partition"
time="2019-12-23 22:48:53" level=error msg="api: Failed to subscribe to partition [stream=JWDkBHPrRoMUbAY, partition=0]: no such partition"

time="2019-12-23 22:49:27" level=error msg="api: Failed to subscribe to partition [stream=hCNxsmzOtvOcgzw, partition=0]: no such partition"
panic: runtime error: slice bounds out of range

goroutine 938 [running]:
github.com/liftbridge-io/liftbridge/server/commitlog.Message.Headers(0xc0001842c0, 0x32, 0x32, 0xc0013d2520)
    /go/pkg/mod/github.com/liftbridge-io/liftbridge@v0.0.0-20191106181350-4bf8a544691a/server/commitlog/message.go:53 +0x302
github.com/liftbridge-io/liftbridge/server.(*apiServer).subscribe.func1()
    /go/pkg/mod/github.com/liftbridge-io/liftbridge@v0.0.0-20191106181350-4bf8a544691a/server/api.go:247 +0x156
github.com/liftbridge-io/liftbridge/server.(*Server).startGoroutine.func1(0xc001f4a7c0, 0xc00017b930)
    /go/pkg/mod/github.com/liftbridge-io/liftbridge@v0.0.0-20191106181350-4bf8a544691a/server/server.go:761 +0x27
created by github.com/liftbridge-io/liftbridge/server.(*Server).startGoroutine
    /go/pkg/mod/github.com/liftbridge-io/liftbridge@v0.0.0-20191106181350-4bf8a544691a/server/server.go:760 +0x97
./script_runner.sh: fg: line 14: job %1 not created under job control
tylertreat commented 4 years ago

Thanks, will take a look.

tylertreat commented 4 years ago

This is caused by https://github.com/liftbridge-io/liftbridge/issues/147.

Closing this issue. Please track the other issue to follow along.