BewareMyPower commented on issue #513:
URL: 
https://github.com/apache/pulsar-client-cpp/issues/513#issuecomment-3489442122

   I added some logs and found the root cause.
   
   ```diff
   @@ -38,13 +39,18 @@ class RetryableLookupService : public LookupService {
       public:
        template <typename... Args>
        explicit RetryableLookupService(PassKey, Args&&... args)
   -        : RetryableLookupService(std::forward<Args>(args)...) {}
   +        : RetryableLookupService(std::forward<Args>(args)...) {
   +        LOG_INFO("XYZ created RetryableLookupService " << (void*)this);
   +    }
   +
   +    ~RetryableLookupService() override { LOG_INFO("XYZ destroyed 
RetryableLookupService " << (void*)this); }
   
        void close() override {
            lookupCache_->clear();
            partitionLookupCache_->clear();
            namespaceLookupCache_->clear();
            getSchemaCache_->clear();
   +        LOG_INFO("XYZ closed RetryableLookupService " << (void*)this);
        }
   
        template <typename... Args>
   @@ -58,9 +64,14 @@ class RetryableLookupService : public LookupService {
        }
   
        Future<Result, LookupDataResultPtr> getPartitionMetadataAsync(const 
TopicNamePtr& topicName) override {
   +        LOG_INFO("XYZ " << (void*)this << " before 
getPartitionMetadataAsync for topic "
   +                        << topicName->toString());
            return partitionLookupCache_->run(
   -            "get-partition-metadata-" + topicName->toString(),
   -            [this, topicName] { return 
lookupService_->getPartitionMetadataAsync(topicName); });
   +            "get-partition-metadata-" + topicName->toString(), [this, 
topicName] {
   +                LOG_INFO("XYZ " << (void*)this << " after 
getPartitionMetadataAsync for topic "
   +                                << topicName->toString());
   +                return lookupService_->getPartitionMetadataAsync(topicName);
   +            });
        }
   ```
   
   ```
   2025-11-05 13:16:33.171 INFO  [0x1ee9d7840] RetryableLookupService:43 | XYZ 
created RetryableLookupService 0x600001b95128
   2025-11-05 13:16:33.171 INFO  [0x1ee9d7840] RetryableLookupService:68 | XYZ 
0x600001b95128 before getPartitionMetadataAsync for topic 
persistent://public/default/testNegativeAckPrecisionBitCnt-11-1762319793
   2025-11-05 13:16:33.171 INFO  [0x1ee9d7840] RetryableLookupService:72 | XYZ 
0x600001b95128 after getPartitionMetadataAsync for topic 
persistent://public/default/testNegativeAckPrecisionBitCnt-11-1762319793
   2025-11-05 13:16:33.230 INFO  [0x1ee9d7840] RetryableLookupService:68 | XYZ 
0x600001b95128 before getPartitionMetadataAsync for topic 
persistent://public/default/testNegativeAckPrecisionBitCnt-11-1762319793
   2025-11-05 13:16:33.230 INFO  [0x1ee9d7840] RetryableLookupService:72 | XYZ 
0x600001b95128 after getPartitionMetadataAsync for topic 
persistent://public/default/testNegativeAckPrecisionBitCnt-11-1762319793
   2025-11-05 13:16:35.250 INFO  [0x17002b000] RetryableLookupService:68 | XYZ 
0x600001b95128 before getPartitionMetadataAsync for topic 
persistent://public/default/testNegativeAckPrecisionBitCnt-11-1762319793
   2025-11-05 13:16:35.255 INFO  [0x17002b000] RetryableLookupService:72 | XYZ 
0x600001b95128 after getPartitionMetadataAsync for topic 
persistent://public/default/testNegativeAckPrecisionBitCnt-11-1762319793
   2025-11-05 13:16:35.259 INFO  [0x1ee9d7840] RetryableLookupService:46 | XYZ 
destroyed RetryableLookupService 0x600001b95128
   2025-11-05 13:16:35.356 INFO  [0x16ff13000] RetryableLookupService:72 | XYZ 
0x600001b95128 after getPartitionMetadataAsync for topic 
persistent://public/default/testNegativeAckPrecisionBitCnt-11-1762319793
   ```
   
   The function passed to `RetryableOperation` captures a pointer to the 
`RetryableLookupService`. After the `RetryableLookupService` object is 
destroyed, the function could still be called.


-- 
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