childe / healer

golang lib for kafka
22 stars 18 forks source link

panic: runtime error: index out of range [3] with length 0 #21

Closed gemiit closed 3 years ago

gemiit commented 3 years ago

当我的gohangout配置的output为kafka的时候会报这个错误:

panic: runtime error: index out of range [3] with length 0

goroutine 228 [running]:
encoding/binary.bigEndian.Uint32(...)
        /usr/local/Cellar/go/1.13.5/libexec/src/encoding/binary/binary.go:111
github.com/childe/healer.NewMetadataResponse(0xc001470000, 0x2acc8, 0x2acc8, 0xc001470000, 0x2acc8, 0x2acc8)
        /Users/go/pkg/mod/github.com/childe/healer@v0.1.4/metadata_response.go:135 +0x106d
github.com/childe/healer.(*Broker).requestMetaData(0xc0012d8540, 0x4928cd6, 0x11, 0x4fa9890, 0x0, 0x0, 0xc000b7a380, 0xc0012d85a0, 0xc00010a9f0)
        /Users/go/pkg/mod/github.com/childe/healer@v0.1.4/broker.go:395 +0x128
github.com/childe/healer.newBrokersFromOne(0xc0012d8540, 0x4928cd6, 0x11, 0xc00086a4b0, 0x0, 0x0, 0x0)
        /Users/go/pkg/mod/github.com/childe/healer@v0.1.4/brokers.go:79 +0x176
github.com/childe/healer.NewBrokersWithConfig(0xc000213120, 0x12, 0xc00086a4b0, 0x4fa9890, 0x1, 0x55c4541cdc1efdcd)
        /Users/go/pkg/mod/github.com/childe/healer@v0.1.4/brokers.go:37 +0x2bd
github.com/childe/healer.NewProducer(0xc0002321e0, 0xb, 0xc000152300, 0x4faadc0)
        /Users/go/pkg/mod/github.com/childe/healer@v0.1.4/producer.go:37 +0x252
github.com/childe/gohangout/output.(*MethodLibrary).NewKafkaOutput(0x4fa9680, 0xc000215110, 0x0)
        /Users/gohangout/output/kafka_output.go:58 +0x53c
reflect.Value.call(0x4894dc0, 0x4fa9680, 0x1213, 0x491cafc, 0x4, 0xc000a31c68, 0x1, 0x1, 0x4a716e0, 0xc0012d84e0, ...)
        /usr/local/Cellar/go/1.13.5/libexec/src/reflect/value.go:460 +0x5f6
reflect.Value.Call(0x4894dc0, 0x4fa9680, 0x1213, 0xc000a31c68, 0x1, 0x1, 0x4fa9680, 0x1213, 0xe)
        /usr/local/Cellar/go/1.13.5/libexec/src/reflect/value.go:321 +0xb4
github.com/childe/gohangout/output.BuildOutput(0xc0002321c0, 0x5, 0xc000215110, 0x11)
        /Users/gohangout/output/output.go:24 +0x22f
github.com/childe/gohangout/topology.BuildOutputs(0xc000214e70, 0x495bd80, 0x471a338, 0xc0000d0c60, 0xc0001e95c0)
        /Users/gohangout/topology/output.go:30 +0x28f
github.com/childe/gohangout/input.(*InputBox).buildTopology(0xc000202640, 0x0, 0x1)
        /Users/gohangout/input/input_box.go:72 +0x4f
github.com/childe/gohangout/input.(*InputBox).beat(0xc000202640, 0x0)
        /Users/gohangout/input/input_box.go:49 +0x4d
created by github.com/childe/gohangout/input.(*InputBox).Beat
        /Users/gohangout/input/input_box.go:108 +0x8f

kafka version: 0.8.2 heale version: 0.1.4 gohangout config:

outputs:
  - Kafka:
      bootstrap.servers: 127.0.0.1:9092
      topic: test
childe commented 3 years ago

0.8 版本的 Kafka 的已经不支持了, 协议变了, 变化的这点不方便向变兼容.

我的感觉是, 1.0之后加了 API 这个接口, 向前兼容才变得非常容易了.