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/10/10 04:22:24 UTC

[GitHub] [pulsar] BewareMyPower opened a new issue #8230: [pulsar-client-cpp] Reader::hasMessageAvailable would never return if broker was terminated by force

BewareMyPower opened a new issue #8230:
URL: https://github.com/apache/pulsar/issues/8230


   **Describe the bug**
   If the reader 
   
   **To Reproduce**
   Steps to reproduce the behavior:
   
   Giving the following client code:
   
   ```c++
   #include <pulsar/Client.h>
   #include <pulsar/Reader.h>
   
   #include <lib/LogUtils.h>
   
   DECLARE_LOG_OBJECT()
   
   using namespace pulsar;
   using namespace std;
   
   int main(int argc, char* argv[]) {
       Client client("pulsar://localhost:6650");
   
       ReaderConfiguration readerConf;
       readerConf.setSubscriptionRolePrefix("reader-sub");
       readerConf.setReaderName("reader");
   
       Reader reader;
       auto result = client.createReader("my-topic", MessageId::earliest(), readerConf, reader);
       if (result != ResultOk) {
           LOG_ERROR("create reader failed: " << result);
           return 2;
       }
   
       int numReceived = 0;
       while (true) {
           bool available;
           auto result = reader.hasMessageAvailable(available);
           if (result != ResultOk) {
               break;
           }
       }
   
       client.close();
       return 0;
   }
   ```
   
   1. Run the pulsar standalone:
       ```bash
       $ bin/pulsar-daemon start standalone
       ```
   2. Run the above client
   3. Kill the standalone by `SIGKILL`:
       ```bash
       $ cat bin/pulsar-standalone.pid | xargs kill -9
       ```
   
   However, the client would never return because it stuck on `hasMessageAvailable`. But if the standalone was terminated by `bin/pulsar-admin stop standalone`, the client would exit normally.
   
   It looks like that the client didn't detect the close of broker.
   
   **Expected behavior**
   `Reader::hasMessageAvailable` should return `ResultNotConnected` even if broker was terminated by force.


----------------------------------------------------------------
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] jiazhai closed issue #8230: [pulsar-client-cpp] Reader::hasMessageAvailable would never return if broker was terminated by force

Posted by GitBox <gi...@apache.org>.
jiazhai closed issue #8230:
URL: https://github.com/apache/pulsar/issues/8230


   


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