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 2019/07/02 11:38:45 UTC

[GitHub] [pulsar] massakam opened a new issue #4658: C++ consumer's connection is often closed

massakam opened a new issue #4658: C++ consumer's connection is often closed
URL: https://github.com/apache/pulsar/issues/4658
 
 
   **Describe the bug**
   
   If C++ consumer subscribes to a topic that a lot of messages are published to, the connection with the broker is often closed and reconnection occurs. This phenomenon seems to occur only when connecting to the broker using TLS.
   
   The following is the client side log at that time:
   
   ```
   2019-07-02 20:07:13.455 INFO  ClientConnection:1274 | [xxx.xxx.xxx.xxx:46586 -> xxx.xxx.xxx.xxx:6651] Connection closed
   2019-07-02 20:07:13.456 INFO  HandlerBase:129 | [persistent://massakam/global/test/t1, sub1, 0] Schedule reconnection in 0.1 s
   2019-07-02 20:07:13.456 WARN  ClientConnection:1153 | [xxx.xxx.xxx.xxx:46586 -> xxx.xxx.xxx.xxx:6651] Could not send message on connection: system:9 Bad file descriptor
   2019-07-02 20:07:13.456 INFO  ClientConnection:1274 | [xxx.xxx.xxx.xxx:46586 -> xxx.xxx.xxx.xxx:6651] Connection closed
   2019-07-02 20:07:13.456 INFO  ClientConnection:211 | [xxx.xxx.xxx.xxx:46586 -> xxx.xxx.xxx.xxx:6651] Destroyed connection
   2019-07-02 20:07:13.556 INFO  HandlerBase:52 | [persistent://massakam/global/test/t1, sub1, 0] Getting connection from pool
   2019-07-02 20:07:13.567 INFO  ConnectionPool:62 | Deleting stale connection from pool for pulsar+ssl://dev-broker11.xxx.xxx.xxx.yahoo.co.jp:6651 use_count: -1 @ 0
   2019-07-02 20:07:13.567 INFO  ConnectionPool:72 | Created connection for pulsar+ssl://dev-broker11.xxx.xxx.xxx.yahoo.co.jp:6651
   2019-07-02 20:07:13.578 INFO  ClientConnection:300 | [xxx.xxx.xxx.xxx:46596 -> xxx.xxx.xxx.xxx:6651] Connected to broker
   2019-07-02 20:07:13.624 INFO  ConsumerImpl:169 | [persistent://massakam/global/test/t1, sub1, 0] Created consumer on broker [xxx.xxx.xxx.xxx:46596 -> xxx.xxx.xxx.xxx:6651]
   ```
   
   There are no errors or warnings in the broker side log.
   
   **To Reproduce**
   Steps to reproduce the behavior:
   1. Compile and execute the following code:
   ```cpp
   #include <iostream>
   #include <pulsar/Client.h>
   
   using namespace std;
   using namespace pulsar;
   
   void messageListener(Consumer consumer, const Message& msg) {
       //cout << "Receive: " << msg.getDataAsString() << endl;
       consumer.acknowledge(msg);
   }
   
   int main() {
       ClientConfiguration config = ClientConfiguration();
       config.setTlsTrustCertsFilePath("<TRUST_CERT_FILE>");
       Client client("pulsar+ssl://<BROKER>:6651", config);
   
       ConsumerConfiguration consumerConfig;
       consumerConfig.setMessageListener(messageListener);
       Consumer consumer;
       Result result = client.subscribe("<TOPIC>", "<SUBSCRIPTION>", consumerConfig, consumer);
   
       if (result != ResultOk) {
           cerr << "Failed to create consumer: " << result << endl;
           return -1;
       }
   
       int n;
       cin >> n;
   
       consumer.close();
       client.close();
   }
   ```
   2. Publish 1KB messages at a rate of about 5000 msg/sec to the topic that the consumer is connecting to.
   ```sh
   $ ./bin/pulsar-perf produce -n 1 -f payload.txt -r 5000 -s 1024 -time 60 <TOPIC>
   ```
   
   **Desktop (please complete the following information):**
    - OS: CentOS 7
   
   **Pulsar version**
   - broker: 2.3.2
   - client: 2.3.2

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


With regards,
Apache Git Services