BewareMyPower opened a new issue, #341: URL: https://github.com/apache/pulsar-client-cpp/issues/341
### Search before asking - [X] I searched in the [issues](https://github.com/apache/pulsar-client-cpp/issues) and found nothing similar. ### Version - Pulsar: 3.1.0 - Client: https://github.com/apache/pulsar-client-cpp/commit/47fb809a3f92fe928f134687d980ffbae9bcdf72 - Apple clang version 14.0.3 ### Minimal reproduce step ```bash ./tests/pulsar-tests --gtest_filter='BasicEndToEndTest.testPartitionedLazyProducerConsumer' ``` ### What did you expect to see? The test should pass. ### What did you see instead? ``` tests/BasicEndToEndTest.cc:544: Failure Expected equality of these values: ResultOk Which is: Ok consumer.receive(m, 10000) Which is: TimeOut ``` It can hardly pass in my local env. ### Anything else? I added some logs ```c++ diff --git a/tests/BasicEndToEndTest.cc b/tests/BasicEndToEndTest.cc index 0951dd4..85ec6f0 100644 --- a/tests/BasicEndToEndTest.cc +++ b/tests/BasicEndToEndTest.cc @@ -533,15 +533,16 @@ void testPartitionedProducerConsumer(bool lazyStartPartitionedProducers, std::st std::stringstream ss; ss << nanoSeconds; Message msg = MessageBuilder().setContent(ss.str()).setPartitionKey(ss.str()).build(); - ASSERT_EQ(ResultOk, producer.send(msg)); - LOG_DEBUG("Message Timestamp is " << msg.getPublishTimestamp()); - LOG_DEBUG("Message is " << msg); + MessageId msgId; + ASSERT_EQ(ResultOk, producer.send(msg, msgId)); + LOG_INFO("XYZ sent to " << msgId); } ASSERT_EQ(consumer.getSubscriptionName(), "subscription-A"); for (int i = 0; i < 10; i++) { Message m; - ASSERT_EQ(ResultOk, consumer.receive(m, 10000)); + ASSERT_EQ(ResultOk, consumer.receive(m, 3000)) << "i: " << i; + LOG_INFO("XYZ received " << m.getMessageId()); consumer.acknowledge(m); } client.shutdown(); ``` And here is a typical failure: ``` 2023-11-09 17:01:03.116 INFO [0x1f72d5e00] BasicEndToEndTest:538 | XYZ sent to (8,0,1,0) 2023-11-09 17:01:03.119 INFO [0x1f72d5e00] BasicEndToEndTest:538 | XYZ sent to (8,1,1,0) 2023-11-09 17:01:03.122 INFO [0x1f72d5e00] BasicEndToEndTest:538 | XYZ sent to (8,2,1,0) 2023-11-09 17:01:03.124 INFO [0x1f72d5e00] BasicEndToEndTest:538 | XYZ sent to (8,3,1,0) 2023-11-09 17:01:03.126 INFO [0x1f72d5e00] BasicEndToEndTest:538 | XYZ sent to (8,4,1,0) 2023-11-09 17:01:03.140 INFO [0x1f72d5e00] BasicEndToEndTest:538 | XYZ sent to (12,0,0,0) 2023-11-09 17:01:03.153 INFO [0x1f72d5e00] BasicEndToEndTest:538 | XYZ sent to (11,0,2,0) 2023-11-09 17:01:03.156 INFO [0x1f72d5e00] BasicEndToEndTest:538 | XYZ sent to (8,5,1,0) 2023-11-09 17:01:03.156 INFO [0x1f72d5e00] BasicEndToEndTest:538 | XYZ sent to (-1,-1,0,0) 2023-11-09 17:01:03.158 INFO [0x1f72d5e00] BasicEndToEndTest:538 | XYZ sent to (12,1,0,0) 2023-11-09 17:01:03.158 INFO [0x1f72d5e00] BasicEndToEndTest:545 | XYZ received (8,0,1,0) 2023-11-09 17:01:03.159 INFO [0x1f72d5e00] BasicEndToEndTest:545 | XYZ received (8,1,1,0) 2023-11-09 17:01:03.159 INFO [0x1f72d5e00] BasicEndToEndTest:545 | XYZ received (8,2,1,0) 2023-11-09 17:01:03.159 INFO [0x1f72d5e00] BasicEndToEndTest:545 | XYZ received (8,3,1,0) 2023-11-09 17:01:03.159 INFO [0x1f72d5e00] BasicEndToEndTest:545 | XYZ received (8,4,1,0) 2023-11-09 17:01:03.159 INFO [0x1f72d5e00] BasicEndToEndTest:545 | XYZ received (12,0,0,0) 2023-11-09 17:01:03.159 INFO [0x1f72d5e00] BasicEndToEndTest:545 | XYZ received (11,0,2,0) 2023-11-09 17:01:03.159 INFO [0x1f72d5e00] BasicEndToEndTest:545 | XYZ received (8,5,1,0) 2023-11-09 17:01:03.159 INFO [0x1f72d5e00] BasicEndToEndTest:545 | XYZ received (12,1,0,0) i: 9 ``` You can see there is a message that failed. ``` 2023-11-09 17:01:03.156 INFO [0x1f72d5e00] BasicEndToEndTest:538 | XYZ sent to (-1,-1,0,0) ``` However, `send` returns `ResultOk`. ### Are you willing to submit a PR? - [X] I'm willing to submit a PR! -- 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]
