flowchartsman opened a new issue #9123: URL: https://github.com/apache/pulsar/issues/9123
**Describe the bug** If you attempt to run the [publishfunc example](https://github.com/apache/pulsar/blob/master/pulsar-function-go/examples/publishFunc/publishFunc.go) (dispatching to alternate topics), your function will panic. building/creating: ``` $ GOOS=linux GOARCH=amd64 go build -o publishfunc $ pulsarctl functions create --tenant public --namespace default --name publishfunc --inputs persistent://public/default/test --go `pwd`/publishfunc ``` pulsar log: ``` panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x48 pc=0xb0d63b] goroutine 1 [running]: github.com/apache/pulsar/pulsar-function-go/pf.(*goInstance).getProducer(0xc00025e000, 0xc8ce41, 0xd, 0xc0003c20e0, 0x6c, 0xe0, /Users/me/go/pkg/mod/github.com/apache/pulsar/[email protected]/pf/instance.go:225 github.com/apache/pulsar/pulsar-function-go/pf.newGoInstance.func1(0xc8ce41, 0xd, 0x6b, 0x6b) /Users/me/go/pkg/mod/github.com/apache/pulsar/[email protected]/pf/instance.go:71 github.com/apache/pulsar/pulsar-function-go/pf.(*FunctionContext).NewOutputMessage(...) /Users/me/go/pkg/mod/github.com/apache/pulsar/[email protected]/pf/context.go:158 main.PublishFunc(0xd8ba60, 0xc0003a0540, 0xc0003c000a, 0x6b, 0x6b, 0x0, 0x0) /Users/me/myproj/functions/publishfunc/main.go:21 +0xd5 reflect.Value.call(0xb96160, 0xcc5fe8, 0x13, 0xc85522, 0x4, 0xc0003a0570, 0x2, 0x2, 0x2, 0x18, ...) /Users/me/opt/go/src/reflect/value.go:476 +0x8c7 reflect.Value.Call(0xb96160, 0xcc5fe8, 0x13, 0xc0003a0570, 0x2, 0x2, 0x1, 0x2, 0x203000) /Users/me/opt/go/src/reflect/value.go:337 +0xb9 github.com/apache/pulsar/pulsar-function-go/pf.newFunction.func1(0xd8ba60, 0xc0003a0540, 0xc0003c000a, 0x6b, 0x6b, 0xc24120, 003a0540, 0xc0001b7cb0, 0x49a426) /Users/me/go/pkg/mod/github.com/apache/pulsar/[email protected]/pf/function.go:126 github.com/apache/pulsar/pulsar-function-go/pf.pulsarFunction.process(0xc000212080, 0xd8ba60, 0xc0003a0540, 0xc0003c000a, 0x6b, c0003a0540, 0xede3128, 0xa12d112d9a5b, ...) /Users/me/go/pkg/mod/github.com/apache/pulsar/[email protected]/pf/function.go:47 github.com/apache/pulsar/pulsar-function-go/pf.(*goInstance).handlerMsg(0xc00025e000, 0xd93460, 0xc0002349c0, 0x0, 0x0, 0x0, 0x0, /Users/me/go/pkg/mod/github.com/apache/pulsar/[email protected]/pf/instance.go:340 github.com/apache/pulsar/pulsar-function-go/pf.(*goInstance).startFunction(0xc00025e000, 0xd7cda0, 0xc000212080, 0x0, 0x0) /Users/me/go/pkg/mod/github.com/apache/pulsar/[email protected]/pf/instance.go:165 github.com/apache/pulsar/pulsar-function-go/pf.Start(0xb96160, 0xcc5fe8) /Users/me/go/pkg/mod/github.com/apache/pulsar/[email protected]/pf/function.go:171 main.main() /Users/me/myproj/functions/publishfunc/main.go:34 +0x39 ``` **To Reproduce** Compile the example exactly as it appears. **Expected behavior** "publish-topic" topic appears containing messages ---------------------------------------------------------------- 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]
