archmangler opened a new issue, #15045: URL: https://github.com/apache/pulsar/issues/15045
**Describe the bug** Connecting to pulsar with a Golang code example results in the following error: ``` reader-fd3917723f, 0] Failed to create consumer: BrokerPersistenceError ``` Complete context: ``` root@pulsar-toolset-0:/pulsar/development# ./pulse 2022/04/06 13:58:50.688 c_client.go:68: [info] INFO | ConnectionPool:84 | Created connection for pulsar://pulsar-broker.pulsar.svc.cluster.local:6650 2022/04/06 13:58:50.710 c_client.go:68: [info] INFO | ClientConnection:364 | [192.168.4.54:45880 -> 192.168.3.142:6650] Connected to broker 2022/04/06 13:58:50.716 c_client.go:68: [info] INFO | HandlerBase:54 | [persistent://ragnarok/transactions/requests, reader-5ada8746c3, 0] Getting connection from pool 2022/04/06 13:58:50.718 c_client.go:68: [info] INFO | ConnectionPool:84 | Created connection for pulsar://pulsar-broker-1.pulsar-broker.pulsar.svc.cluster.local:6650 2022/04/06 13:58:50.720 c_client.go:68: [info] INFO | ClientConnection:364 | [192.168.4.54:36066 -> 192.168.6.237:6650] Connected to broker 2022/04/06 13:58:50.723 c_client.go:68: [info] WARN | ClientConnection:971 | [192.168.4.54:36066 -> 192.168.6.237:6650] Received error response from server: BrokerPersistenceError -- req_id: 0 2022/04/06 13:58:50.723 c_client.go:68: [info] ERROR | ConsumerImpl:263 | [persistent://ragnarok/transactions/requests, reader-5ada8746c3, 0] Failed to create consumer: BrokerPersistenceError 2022/04/06 13:58:50 Could not create reader: Failed to create Reader: BrokerPersistenceError ``` I have been getting this error consistently when using the example Golang code for a Reader (here: https://pulsar.apache.org/docs/en/2.3.1/client-libraries-go/#readers). To recover, I need to restart the brokers with something like: ``` kubectl rollout restart sts pulsar-broker -n pulsar ``` **To Reproduce** Steps to reproduce the behavior: 1. Copy the `Reader` code from https://pulsar.apache.org/docs/en/2.3.1/client-libraries-go/#readers, go build <scriptname>: ``` import ( "context" "log" "github.com/apache/pulsar/pulsar-client-go/pulsar" ) func main() { // Instantiate a Pulsar client client, err := pulsar.NewClient(pulsar.ClientOptions{ URL: "pulsar://localhost:6650", }) if err != nil { log.Fatalf("Could not create client: %v", err) } // Use the client to instantiate a reader reader, err := client.CreateReader(pulsar.ReaderOptions{ Topic: "my-golang-topic", StartMessageID: pulsar.EarliestMessage, }) if err != nil { log.Fatalf("Could not create reader: %v", err) } defer reader.Close() ctx := context.Background() // Listen on the topic for incoming messages for { msg, err := reader.Next(ctx) if err != nil { log.Fatalf("Error reading from topic: %v", err) } // Process the message } } ``` 3. Run the Golang client reader once to connect to pulsar. 4. Cancel the client (ctrl-c) 5. Try rerun the client again **Expected behavior** The client should cancel gracefully and when rerun connect to pulsar broker successfully. **Screenshots** If applicable, add screenshots to help explain your problem. **Desktop (please complete the following information):** - OS: Alpine Docker container on Kubernetes. **Additional context** Add any other context about the problem here. -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
