Go client Reader panics when passing custom StartMessageID
See original GitHub issueExpected behavior
I can pass arbitrary type implementing the pulsar.MessageID
interface in pulsar.ReaderOptions
when creating a Reader instance.
Actual behavior
When I pass a custom type the client library panics:
panic: interface conversion: pulsar.MessageID is mypackage.pulsarMessageID, not *pulsar.messageID
/usr/local/go/src/runtime/panic.go:513 +0x1b9
github.com/apache/pulsar/pulsar-client-go/pulsar.createReaderAsync(0xc0002229a0, 0xc0001fe29a, 0x9, 0x0, 0x0, 0xb800a0, 0xc0002fb6e0, 0xc00018dd40, 0x0, 0x0, ...)
/go/pkg/mod/github.com/apache/pulsar@v2.2.0+incompatible/pulsar-client-go/pulsar/c_reader.go:115 +0x504
github.com/apache/pulsar/pulsar-client-go/pulsar.(*client).CreateReaderAsync(0xc0002229a0, 0xc0001fe29a, 0x9, 0x0, 0x0, 0xb800a0, 0xc0002fb6e0, 0x0, 0x0, 0x0, ...)
/go/pkg/mod/github.com/apache/pulsar@v2.2.0+incompatible/pulsar-client-go/pulsar/c_client.go:220 +0x65
github.com/apache/pulsar/pulsar-client-go/pulsar.(*client).CreateReader(0xc0002229a0, 0xc0001fe29a, 0x9, 0x0, 0x0, 0xb800a0, 0xc0002fb6e0, 0x0, 0x0, 0x0, ...)
/go/pkg/mod/github.com/apache/pulsar@v2.2.0+incompatible/pulsar-client-go/pulsar/c_client.go:207 +0xca
The culprit is the following line:
// Unchecked type assertion assuming that StartMessageID is of type *messageID
C._pulsar_client_create_reader_async(client.ptr, topic, options.StartMessageID.(*messageID).ptr,
conf, savePointer(&readerAndCallback{reader, conf, callback}))
Steps to reproduce
See above
System configuration
Pulsar version: 2.2 github.com/apache/pulsar v2.2.0+incompatible h1:i2dfg67DNdHRgdzdIiSObTb9VRavAtZStxC4YIySxAI= github.com/apache/pulsar v2.2.0+incompatible/go.mod h1:7npmYEEu+jEeIMdpGSJwrTxUB86OW/UM5IkJCAyfl5Y= g
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Go client Reader panics when passing custom StartMessageID ...
Reader client's CreateReader API should not panic at runtime when using a custom type ... Go client Reader panics when passing custom StartMessageID...
Read more >pulsar - Go Packages
NackBackoffPolicy is a interface for custom message negativeAcked policy, users can specify a NackBackoffPolicy for a consumer. > Notice: the ...
Read more >Pulsar Go client
Download the library of Go client to local environment: ... MessageRouter set a custom message routing policy by passing an ... StartMessageID: pulsar....
Read more >Accessing Kubernetes CRDs from the client-go package
The Kubernetes API server is easily extendable by Custom Resource Defintions. However, actually accessing these resources from the popular ...
Read more >CHANGELOG.md · Gitee 极速下载/pulsar-client-go - Gitee.com
由于 Go 语言与生俱来的优势以及 Go 社区的不断壮大,Pulsar 社区对 Go Client 的呼声 ... Fix panic in CreateReader API using custom MessageID for ReaderOptions, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@wolfstudy the same panic happens with native go client
Here’s what I tried.
Should I open an issue for native go client repo referencing this issue?
Cool Thanks to @nitishv the https://github.com/apache/pulsar-client-go/pull/305 has been merged to master, will close the issue.