You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/03/24 03:19:19 UTC

[GitHub] [pulsar] BewareMyPower opened a new pull request #14834: [C++] Fix segmentation fault when creating socket failed

BewareMyPower opened a new pull request #14834:
URL: https://github.com/apache/pulsar/pull/14834


   ### Motivation
   
   https://github.com/apache/pulsar/pull/14823 fixes the flaky
   `testConnectTimeout` but it's also a regression of
   https://github.com/apache/pulsar/pull/14587. Because when the fd limit
   is reached, the `connectionTimeoutTask_` won't be initialized with a
   non-null value. Calling `stop` method on it directly will cause
   segmentation fault.
   
   See
   https://github.com/apache/pulsar/blob/0fe921f32cefe7648ca428cd9861f9163c69767d/pulsar-client-cpp/lib/ClientConnection.cc#L178-L185
   
   ### Modifications
   
   Add the null check for `connectionTimeoutTask_` in `ClientConnection::close`.


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower commented on pull request #14834: [C++] Fix segmentation fault when creating socket failed

Posted by GitBox <gi...@apache.org>.
BewareMyPower commented on pull request #14834:
URL: https://github.com/apache/pulsar/pull/14834#issuecomment-1077043925


   It looks hard to add a test. I tried to set the resource limit in tests but cannot restore the original value.
   
   ```c++
   #ifndef _MSC_VER
   TEST(ClientTest, testTooManyFiles) {
       struct rlimit originalLimit;
       getrlimit(RLIMIT_NOFILE, &originalLimit);
   
       struct rlimit currentLimit;
       currentLimit.rlim_cur = 1;
       currentLimit.rlim_max = 1;
       setrlimit(RLIMIT_NOFILE, &currentLimit);
   
       /* Tests here ... */
   
       setrlimit(RLIMIT_NOFILE, &originalLimit);  // it failed with Operation not permitted
   }
   #endif


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower merged pull request #14834: [C++] Fix segmentation fault when creating socket failed

Posted by GitBox <gi...@apache.org>.
BewareMyPower merged pull request #14834:
URL: https://github.com/apache/pulsar/pull/14834


   


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org