phemmer opened a new issue #6790:
URL: https://github.com/apache/pulsar/issues/6790


   **Describe the bug**
   When creating a go function with an input topic name that is non-normalized 
(e.g. `public/default/input`), the function panics due to different topic names 
being used.
   
   **To Reproduce**
   Steps to reproduce the behavior:
   1. Create a go function with input topic `public/default/input`.
   2. Publish a message to the topic
   3. Watch for panic in the logs.
   
   **Expected behavior**
   No panic
   
   **Screenshots**
   ```
   panic: runtime error: invalid memory address or nil pointer dereference
   [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x8d8103]
   
   goroutine 14 [running]:
   
github.com/apache/pulsar/pulsar-function-go/pf.(*goInstance).ackInputMessage(0xc0000c6640,
 0xb29040, 0xc0016543c0)
        
/home/phemmer/.go/src/github.com/apache/pulsar/pulsar-function-go/pf/instance.go:301
 +0x73
   
github.com/apache/pulsar/pulsar-function-go/pf.(*goInstance).processResult.func1(0xb16ea0,
 0xc000096bc0, 0xc00168c090, 0x0, 0x0)
        
/home/phemmer/.go/src/github.com/apache/pulsar/pulsar-function-go/pf/instance.go:291
 +0xf4
   
github.com/apache/pulsar-client-go/pulsar.(*partitionProducer).ReceivedSendReceipt(0xc0004cc140,
 0xc000096b40)
        
/home/phemmer/.go/src/github.com/apache/pulsar-client-go/pulsar/producer_partition.go:432
 +0x260
   
github.com/apache/pulsar-client-go/pulsar/internal.(*connection).handleSendReceipt(0xc001598120,
 0xc000096b40)
        
/home/phemmer/.go/src/github.com/apache/pulsar-client-go/pulsar/internal/connection.go:518
 +0xfe
   
github.com/apache/pulsar-client-go/pulsar/internal.(*connection).internalReceivedCommand(0xc001598120,
 0xc0004cb180, 0x0, 0x0)
        
/home/phemmer/.go/src/github.com/apache/pulsar-client-go/pulsar/internal/connection.go:437
 +0x1ce
   
github.com/apache/pulsar-client-go/pulsar/internal.(*connection).run(0xc001598120)
        
/home/phemmer/.go/src/github.com/apache/pulsar-client-go/pulsar/internal/connection.go:325
 +0x304
   
github.com/apache/pulsar-client-go/pulsar/internal.(*connection).start.func1(0xc001598120)
        
/home/phemmer/.go/src/github.com/apache/pulsar-client-go/pulsar/internal/connection.go:195
 +0x59
   created by 
github.com/apache/pulsar-client-go/pulsar/internal.(*connection).start
        
/home/phemmer/.go/src/github.com/apache/pulsar-client-go/pulsar/internal/connection.go:192
 +0x3f
   ```
   
   **Additional context**
   The issue in this panic is because 
[`ackInputMessage()`](https://github.com/apache/pulsar/blob/v2.5.1/pulsar-function-go/pf/instance.go#L263)
 is using the topic name `persistent://public/default/input`. However 
[`setupConsumer()`](https://github.com/apache/pulsar/blob/v2.5.1/pulsar-function-go/pf/instance.go#L220)
 is using `public/default/input`.
   
   This normalization could be done by the go library prior to storing in the 
`gi.consumers` map. However I think it would be more appropriate for the topic 
name to be normalized before passing to the go application as an argument, as 
this normalization should apply to all languages.


----------------------------------------------------------------
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:
[email protected]


Reply via email to