krvarma opened a new issue #250:
URL: https://github.com/apache/pulsar-client-go/issues/250
#### Expected behavior
pulsar-client-go SDK should work on ARM without any issues
#### Actual behavior
The SDK crashed on ARM-based devices when trying to Subscribe. The crash
occurs when we call `client.Subscribe`. The crash occurs at this point on the
code.
```
consumer, err := client.Subscribe(pulsar.ConsumerOptions{
Topic: "my-topic",
SubscriptionName: "first-subscription",
Type: pulsar.Exclusive,
})
```
#### Steps to reproduce
Run the following simple consumer go program on ARM-based device (Tested on
Raspberry Pi 3 Model B+).
```
package main
import (
"fmt"
"log"
"os"
"context"
"github.com/apache/pulsar-client-go/pulsar"
)
func main() {
client, err := pulsar.NewClient(pulsar.ClientOptions{URL:
"pulsar://localhost:6650"})
if err != nil {
log.Fatal(err)
}
defer client.Close()
consumer, err := client.Subscribe(pulsar.ConsumerOptions{
Topic: "my-topic",
SubscriptionName: "first-subscription",
Type: pulsar.Exclusive,
})
if err != nil {
log.Fatal(err)
}
defer consumer.Close()
ctx := context.Background()
// Listen indefinitely on the topic
for {
msg, err := consumer.Receive(ctx)
if err != nil { log.Fatal(err) }
// Do something with the message
fmt.Printf("Message Received: %v\n", string(msg.Payload()))
if err == nil {
// Message processed successfully
consumer.Ack(msg)
} else {
// Failed to process messages
consumer.Nack(msg)
}
}
}
```
#### Crash log
```
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x12324]
goroutine 1 [running]:
runtime/internal/atomic.goXadd64(0x88e194, 0x1, 0x0, 0x37ca01, 0xca01f8)
/usr/lib/go-1.11/src/runtime/internal/atomic/atomic_arm.go:96 +0x1c
github.com/apache/pulsar-client-go/pulsar/internal.(*rpcClient).NewRequestID(0x88e180,
0xca01f8, 0xdf8d40)
/home/pi/go/pkg/mod/github.com/apache/[email protected]/pulsar/internal/rpc_client.go:158
+0x34
github.com/apache/pulsar-client-go/pulsar.(*client).TopicPartitions(0xdf8c00,
0x39a6c3, 0x8, 0x878800, 0xcaa180, 0x0, 0x39b268, 0xa)
/home/pi/go/pkg/mod/github.com/apache/[email protected]/pulsar/client_impl.go:135
+0x68
github.com/apache/pulsar-client-go/pulsar.internalTopicSubscribe(0xdf8c00,
0x39a6c3, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/home/pi/go/pkg/mod/github.com/apache/[email protected]/pulsar/consumer_impl.go:133
+0x110
github.com/apache/pulsar-client-go/pulsar.topicSubscribe(0xdf8c00, 0x39a6c3,
0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/home/pi/go/pkg/mod/github.com/apache/[email protected]/pulsar/consumer_impl.go:220
+0x48
github.com/apache/pulsar-client-go/pulsar.newConsumer(0xdf8c00, 0x39a6c3,
0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/home/pi/go/pkg/mod/github.com/apache/[email protected]/pulsar/consumer_impl.go:94
+0x158
github.com/apache/pulsar-client-go/pulsar.(*client).Subscribe(0xdf8c00,
0x39a6c3, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/home/pi/go/pkg/mod/github.com/apache/[email protected]/pulsar/client_impl.go:112
+0x28
main.main()
/home/pi/consumer_rpi.go:19 +0xd0
exit status 2
```
#### System configuration
_Device_: Raspberry Pi Model B+
_OS_: Raspbian Buster Lite
_pulsar-client-go SDK version_: 0.1.0
_Pulsar version_: 2.5.1
----------------------------------------------------------------
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]