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 2020/04/26 14:37:33 UTC

[GitHub] [pulsar] BewareMyPower opened a new pull request #6827: [Issue 6822][C++] Fix segmentation fault if handleSendTimeout() is called after closeAsync()

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


   Fixes #6822 
   
   ### Motivation
   
   Whan I reduced the send timeout to reproduce `ResultTimeout` error, I found that the program may cause segmentation fault after closed accidentally. Then I found  `ProducerImpl::handleSendTimeout()` doesn't check the state or other fields of `ProducerImpl`, which may cause that a null `sendTimer_` calls its methods.
   
   ### Modifications
   
   - Acquire `mutex_` and check if the `state_` is `Ready` before handling the send timer callback;
   - Devide `failPendingMessages()` into two parts which are `getPendingCallbacksWhenFailedWithLock()` and `PendingCallbacks::complete()`.
   
       - The 1st part needs to acquire `mutex_` to access class members safely. In addition, we already hold `mutex_` before `failPendingMessages()`, so we need a method to get necessary callbacks without the lock.
       - The 2nd part doesn't and shouldn't acquire `mutex_`, because we don't know how long user provided callbacks may cost. If lock this part, `mutex_` may be hold for a long time.
   - Define a new struct contains a `BatchMessageContainer::MessageContainerListPtr` field, because nested classes can't be forward declared.
   
   ### Verifying this change
   
   - [ ] Make sure that the change passes the CI checks.
   
   This change can be verified as follows:
   - Try to reproduce the error as #6822;
   - From the log you can see no callbacks called after `closeAsync()` and the program exited normally.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower commented on pull request #6827: [Issue 6822][C++] Fix segmentation fault if handleSendTimeout() is called after closeAsync()

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


   /pulsarbot run-failure-checks


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower commented on pull request #6827: [Issue 6822][C++] Fix segmentation fault if handleSendTimeout() is called after closeAsync()

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


   /pulsarbot run-failure-checks


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower commented on pull request #6827: [Issue 6822][C++] Fix segmentation fault if handleSendTimeout() is called after closeAsync()

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


   /pulsarbot run-failure-checks


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower removed a comment on pull request #6827: [Issue 6822][C++] Fix segmentation fault if handleSendTimeout() is called after closeAsync()

Posted by GitBox <gi...@apache.org>.
BewareMyPower removed a comment on pull request #6827:
URL: https://github.com/apache/pulsar/pull/6827#issuecomment-619660511






----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower commented on pull request #6827: [Issue 6822][C++] Fix segmentation fault if handleSendTimeout() is called after closeAsync()

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


   /pulsarbot run-failure-checks


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] sijie merged pull request #6827: [Issue 6822][C++] Fix segmentation fault if handleSendTimeout() is called after closeAsync()

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


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower commented on pull request #6827: [Issue 6822][C++] Fix segmentation fault if handleSendTimeout() is called after closeAsync()

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


   /pulsarbot run-failure-checks


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower commented on pull request #6827: [Issue 6822][C++] Fix segmentation fault if handleSendTimeout() is called after closeAsync()

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


   /pulsarbot run-failure-checks


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower removed a comment on pull request #6827: [Issue 6822][C++] Fix segmentation fault if handleSendTimeout() is called after closeAsync()

Posted by GitBox <gi...@apache.org>.
BewareMyPower removed a comment on pull request #6827:
URL: https://github.com/apache/pulsar/pull/6827#issuecomment-619595555


   /pulsarbot run-failure-checks


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] sijie commented on pull request #6827: [Issue 6822][C++] Fix segmentation fault if handleSendTimeout() is called after closeAsync()

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


   @jiazhai Can you review this pull request?


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower commented on pull request #6827: [Issue 6822][C++] Fix segmentation fault if handleSendTimeout() is called after closeAsync()

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


   /pulsarbot run-failure-checks


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower commented on pull request #6827: [Issue 6822][C++] Fix segmentation fault if handleSendTimeout() is called after closeAsync()

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


   /pulsarbot run-failure-checks


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower commented on pull request #6827: [Issue 6822][C++] Fix segmentation fault if handleSendTimeout() is called after closeAsync()

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


   /pulsarbot run-failure-checks


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower commented on pull request #6827: [Issue 6822][C++] Fix segmentation fault if handleSendTimeout() is called after closeAsync()

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


   /pulsarbot run-failure-checks


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower commented on pull request #6827: [Issue 6822][C++] Fix segmentation fault if handleSendTimeout() is called after closeAsync()

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


   /pulsarbot run-failure-checks


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower commented on pull request #6827: [Issue 6822][C++] Fix segmentation fault if handleSendTimeout() is called after closeAsync()

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


   /pulsarbot run-failure-checks


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower commented on pull request #6827: [Issue 6822][C++] Fix segmentation fault if handleSendTimeout() is called after closeAsync()

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


   /pulsarbot run-failure-checks


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower commented on pull request #6827: [Issue 6822][C++] Fix segmentation fault if handleSendTimeout() is called after closeAsync()

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


   /pulsarbot run-failure-checks


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower commented on pull request #6827: [Issue 6822][C++] Fix segmentation fault if handleSendTimeout() is called after closeAsync()

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


   /pulsarbot run-failure-checks


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower commented on pull request #6827: [Issue 6822][C++] Fix segmentation fault if handleSendTimeout() is called after closeAsync()

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


   /pulsarbot run-failure-checks


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower commented on pull request #6827: [Issue 6822][C++] Fix segmentation fault if handleSendTimeout() is called after closeAsync()

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


   /pulsarbot run-failure-checks


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower commented on pull request #6827: [Issue 6822][C++] Fix segmentation fault if handleSendTimeout() is called after closeAsync()

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






----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower commented on pull request #6827: [Issue 6822][C++] Fix segmentation fault if handleSendTimeout() is called after closeAsync()

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


   /pulsarbot run-failure-checks


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower removed a comment on pull request #6827: [Issue 6822][C++] Fix segmentation fault if handleSendTimeout() is called after closeAsync()

Posted by GitBox <gi...@apache.org>.
BewareMyPower removed a comment on pull request #6827:
URL: https://github.com/apache/pulsar/pull/6827#issuecomment-631356794






----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower commented on pull request #6827: [Issue 6822][C++] Fix segmentation fault if handleSendTimeout() is called after closeAsync()

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


   /pulsarbot run-failure-checks


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower commented on pull request #6827: [Issue 6822][C++] Fix segmentation fault if handleSendTimeout() is called after closeAsync()

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


   /pulsarbot run-failure-checks


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower commented on pull request #6827: [Issue 6822][C++] Fix segmentation fault if handleSendTimeout() is called after closeAsync()

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


   /pulsarbot run-failure-checks


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] codelipenghui commented on pull request #6827: [Issue 6822][C++] Fix segmentation fault if handleSendTimeout() is called after closeAsync()

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


   @BewareMyPower Could you please rebase with the master branch?


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower commented on pull request #6827: [Issue 6822][C++] Fix segmentation fault if handleSendTimeout() is called after closeAsync()

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


   @codelipenghui Okay


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower removed a comment on pull request #6827: [Issue 6822][C++] Fix segmentation fault if handleSendTimeout() is called after closeAsync()

Posted by GitBox <gi...@apache.org>.
BewareMyPower removed a comment on pull request #6827:
URL: https://github.com/apache/pulsar/pull/6827#issuecomment-619583348


   /pulsarbot run-failure-checks


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower commented on pull request #6827: [Issue 6822][C++] Fix segmentation fault if handleSendTimeout() is called after closeAsync()

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


   /pulsarbot run-failure-checks


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower commented on pull request #6827: [Issue 6822][C++] Fix segmentation fault if handleSendTimeout() is called after closeAsync()

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


   /pulsarbot run-failure-checks


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower commented on pull request #6827: [Issue 6822][C++] Fix segmentation fault if handleSendTimeout() is called after closeAsync()

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


   /pulsarbot run-failure-checks


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower commented on pull request #6827: [Issue 6822][C++] Fix segmentation fault if handleSendTimeout() is called after closeAsync()

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


   /pulsarbot run-failure-checks


----------------------------------------------------------------
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:
users@infra.apache.org