apache / apache/pulsar-client-go

message.GetSchemaValue() panics if message.schema is nil

Open
#482 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
745
Forks
389
Avg merge
3d 20h
Merged PRs (30d)
3

Description

#### Expected behavior
Calling message.GetSchemaValue() should handle nil pointer deref on message.schema, and return error and not panic

#### Actual behavior
Calling message.GetSchemaValue() when schema is nil panics

#### Steps to reproduce
```
consumer, err := (*ps.Client).Subscribe(apachePulsar.ConsumerOptions{
Topic: topic, // some topic name
SubscriptionName: name,
MessageChannel: listenerChan, // a channel for incoming messages
Type: apachePulsar.Shared,
Schema: schema,
})

func handler() { err := msg.GetSchemaValue(val) }

for cm := range listenerChan {
msg := cm.Message
go func() {
handler(msg)
(*consumer).Ack(msg)
}()
}

```
handler panics, process dies

#### Notes: unclear why schema is undefined, producer for topic in this test is registered with schema. Utilizing protobuf schema, which is succesfully created using NewProtoSchema

#### System configuration
**Pulsar version**: 2.7.0
**pulsar-client-go**: v0.3.0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.