BewareMyPower opened a new pull request, #121:
URL: https://github.com/apache/pulsar-client-cpp/pull/121

   ### Motivation
   
   When I ran the tests of Python wrapper in my local env, I observed a 
segmentation fault. See the key stacktrace:
   
   ```
   #3  0x00007ffff6d742c5 in std::unique_lock<std::mutex>::lock() () from 
/usr/local/lib/python3.8/dist-packages/_pulsar.cpython-38-x86_64-linux-gnu.so
   #4  0x00007ffff6d72523 in 
std::unique_lock<std::mutex>::unique_lock(std::mutex&) ()
      from 
/usr/local/lib/python3.8/dist-packages/_pulsar.cpython-38-x86_64-linux-gnu.so
   #5  0x00007ffff67de193 in pulsar::ClientImpl::newRequestId (this=0x0) at 
/home/xyz/github.com/apache/pulsar-client-cpp/lib/ClientImpl.cc:644
   #6  0x00007ffff685d2c2 in pulsar::ConsumerImpl::~ConsumerImpl 
(this=0x7fff9800f9e0, __in_chrg=<optimized out>)
       at /home/xyz/github.com/apache/pulsar-client-cpp/lib/ConsumerImpl.cc:116
   ```
   
   In the destructor of `ConsumerImpl`, `client->newRequestId` might be called. 
However, `client` might be a null pointer because it's returned by 
`std::weak_ptr::lock()`.
   
   ### Modifications
   
   Add null check to avoid the segfault.


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