oversearch opened a new pull request #8596:
URL: https://github.com/apache/pulsar/pull/8596


   ### Motivation
   
   The current `getRandomName` function contains a simple dangling reference 
bug: when it attempts to return a `const char*` string value from the temporary 
string returned by the `std::stringstream::str` function.  This sometimes 
"works" anyway in release mode depending on the platform it's running on, but 
in debug mode on all the versions of GCC and CLANG I've tried it segfaults.  
This makes debugging the c++ client very annoying.
   
   ### Modifications
   
   I found the existing method for generating random strings rather obscure, so 
I both fixed the bug and simplified the code.  I made use of `boost::random` to 
provide a much more straightforward implementation.  I use this pattern often 
for random names in my company's production projects, and it works well.
   
   ### Verifying this change
   
   - [ ] Make sure that the change passes the CI checks.
   
   This code is called every time the client subscribes to a topic, so it gets 
plenty of coverage throughout the tests. I also manually verified that it's 
working correctly by printing the random names while I was testing.  I've 
already included this fix in a local build of Pulsar I'm using for a new 
product at FactSet, and it's working well there.
   
   The CI checks are failing with some error about a website deployment that 
seems unrelated to the C++ client.  Is this a problem?  Please let me know if I 
need to do anything special to get those checks to pass.  Thanks!
   


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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to