You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/03/04 18:52:52 UTC

[GitHub] [pulsar-client-go] sloan-dog opened a new issue #482: message.GetSchemaValue() panics if message.schema is nil

sloan-dog opened a new issue #482:
URL: https://github.com/apache/pulsar-client-go/issues/482


   #### 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 undefined 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


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org