BewareMyPower opened a new issue, #325:
URL: https://github.com/apache/pulsar-client-cpp/issues/325

   ### 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/eea59bb4458c6ea190f51732d41fdb32c9ad6327
   
   ### Minimal reproduce step
   
   To simulate the send error is returned, we need to run the following code on 
a Pulsar release that does not include 
https://github.com/apache/pulsar/pull/20948
   
   ```c++
   #include <pulsar/Client.h>
   
   #include <chrono>
   #include <iostream>
   #include <thread>
   
   using namespace pulsar;
   
   int main() {
       Client client("pulsar://127.0.0.1:6650");
   
       Producer producer;
       ProducerConfiguration conf;
       conf.setBatchingEnabled(false);
       conf.setChunkingEnabled(true);
       client.createProducer("persistent://public/default/my-topic", conf, 
producer);
   
       producer.sendAsync(MessageBuilder().setContent(std::string(1024000 * 5, 
'a')).build(),
                          [](Result result, const MessageId& msgId) {
                              std::cout << "XYZ send " << result << " " << 
msgId << std::endl;
                          });
       std::this_thread::sleep_for(std::chrono::seconds(1));
   
       client.close();
   }
   ```
   
   ### What did you expect to see?
   
   The application exits normally.
   
   ### What did you see instead?
   
   ```
   2023-10-08 11:35:05.027 WARN  [0x16bb3f000] ClientConnection:1530 | 
[127.0.0.1:55461 -> 127.0.0.1:6650] Received send error from server: Cannot 
determine whether the message is a duplicate at this time
   2023-10-08 11:35:05.027 INFO  [0x16bb3f000] ClientConnection:1340 | 
[127.0.0.1:55461 -> 127.0.0.1:6650] Connection disconnected
   2023-10-08 11:35:05.027 INFO  [0x16bb3f000] ConnectionPool:122 | Remove 
connection for pulsar://localhost:6650
   2023-10-08 11:35:05.027 INFO  [0x16bb3f000] ClientConnection:268 | 
[127.0.0.1:55461 -> 127.0.0.1:6650] Destroyed connection to 
pulsar://localhost:6650
   zsh: segmentation fault  ./build/tests/ChunkDedupTest
   ```
   
   You can also see the failure reproduced in [this 
workflow](https://github.com/BewareMyPower/pulsar-client-cpp/actions/runs/6445251207/job/17499099651?pr=22):
 
   
   ```
   [----------] 1 test from ChunkDedupTest
   [ RUN      ] ChunkDedupTest.testSendChunks
   2023-10-08 03:32:50.574 INFO  [139665533579648] ClientConnection:188 | 
[<none> -> pulsar://localhost:6650] Create ClientConnection, timeout=10000
   2023-10-08 03:32:50.574 INFO  [139665533579648] ConnectionPool:107 | Created 
connection for pulsar://localhost:6650
   2023-10-08 03:32:50.578 INFO  [139665518995008] ClientConnection:398 | 
[[::1]:43874 -> [::1]:6650] Connected to broker
   2023-10-08 03:32:50.655 INFO  [139665518995008] HandlerBase:81 | 
[persistent://public/default/test-send-chunks, ] Getting connection from pool
   2023-10-08 03:32:51.124 INFO  
[1396[655](https://github.com/BewareMyPower/pulsar-client-cpp/actions/runs/6445210808/job/17499021562?pr=22#step:8:656)18995008]
 ProducerImpl:199 | [persistent://public/default/test-send-chunks, ] Created 
producer on broker [[::1]:43874 -> [::1]:6650] 
   2023-10-08 03:32:51.293 WARN  [139665518995008] ClientConnection:1528 | 
[[::1]:43874 -> [::1]:6650] Received send error from server: Cannot determine 
whether the message is a duplicate at this time
   2023-10-08 03:32:51.294 INFO  [139665518995008] ClientConnection:1340 | 
[[::1]:43874 -> [::1]:6650] Connection disconnected
   2023-10-08 03:32:51.294 INFO  [139665518995008] ConnectionPool:122 | Remove 
connection for pulsar://localhost:6650
   2023-10-08 03:32:51.294 INFO  
[1396[655](https://github.com/BewareMyPower/pulsar-client-cpp/actions/runs/6445210808/job/17499021562?pr=22#step:8:656)18995008]
 HandlerBase:141 | [persistent://public/default/test-send-chunks, 
standalone-0-0] Schedule reconnection in 0.1 s
   2023-10-08 03:32:51.295 INFO  [139665518995008] ClientConnection:268 | 
[[::1]:43874 -> [::1]:6650] Destroyed connection to pulsar://localhost:6650
   ./run-unit-tests.sh: line 51:  6925 Segmentation fault      (core dumped) 
$CMAKE_BUILD_DIRECTORY/tests/ChunkDedupTest --gtest_repeat=10
   Error: Process completed with exit code 139.
   ```
   
   ### Anything else?
   
   The root cause might be 
https://github.com/apache/pulsar-client-cpp/pull/317. I tried reverting that 
commit in my local env and it never crashed.
   
   Here is also a similar crash report: 
https://github.com/apache/pulsar-client-cpp/issues/324
   
   ### 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]

Reply via email to