BewareMyPower commented on issue #10721:
URL: https://github.com/apache/pulsar/issues/10721#issuecomment-861617256


   I'm currently working on the connection timeout, but I found something 
confused from your logs.
   
   Here're my analysis from your logs (logs_f.txt):
   
   ```bash
   # "Created connection" means the socket object was created and started to 
connect.
   # **connection** means the ClientConnection object that contains a socket 
and other fields, not the real TCP connection.
   2021-06-01 15:48:49.554 INFO  [140607179827008] ConnectionPool:84 | Created 
connection for pulsar://pulsar-blt-broker.broker-load-test-blt:6650
   # "Connected to broker" means the TCP connection was established 
successfully.
   2021-06-01 15:48:49.556 INFO  [140607120344832] ClientConnection:364 | 
[10.0.181.183:44014 -> 10.0.187.196:6650] Connected to broker
   # After about 40 seconds, the connection closed.  It's because no PONG 
command has been received from broker
   # for 30 seconds after the client sent the PING command to broker.
   .2021-06-01 15:49:37.816 WARN  [140607145748224] ClientConnection:1368 | 
[10.0.181.183:43844 -> 10.0.187.196:6650] Forcing connection to close after 
keep-alive timeout
   2021-06-01 15:49:37.816 INFO  [140607145748224] ClientConnection:1436 | 
[10.0.181.183:43844 -> 10.0.187.196:6650] Connection closed
   ```
   
   The conclusion is that the client connected to a broker successfully and 
quickly (15:48:49.556 - 15:48:49.554 = 2 milliseconds), but received no 
responses from broker.
   
   What I'm confused is, the last line of `logs_f.txt` is
   
   ```
   2021-06-01 15:49:37.935 INFO  [140607145748224] ProducerImpl:170 | 
[persistent://public/default/foobar-partition-25, pulsar-blt-102-8] Created 
producer on broker [10.0.181.183:36136 -> 10.0.178.77:6650]
   ```
   
   It's less than 1 minutes from the time point you stopped your broker, see
   
   > In this log segment, the broker was killed at 15:48:46
   
   And the last line of your logs means your produce has been created 
successfully. So I don't understand
   
   > The logs below showed no activity for more than 5 minutes.
   
   BTW, could you enable debug logging and test again? You can take 
https://github.com/apache/pulsar/pull/7713 for example.
   
   ```python
   import logging
   import pulsar
   
   class Client:
       def __init__(self):
           self.client = pulsar.Client(
               
service_url='pulsar://pulsar-blt-broker.broker-load-test-blt:6650',
               operation_timeout_seconds=5,
               logger=logging.getLogger("pulsar")
           )
   
       def get_producer(self):
           return self.client.create_producer(
               'foobar',
               block_if_queue_full=True,
               send_timeout_millis=1000,
               batching_enabled=False
           )
           
       def run(self):
           producer = self.get_producer()
           # TODO: add your logic here
   
       def close(self):
           self.client.close()
   
   if __name__ == '__main__':
       # Write the debug level logs to debug.log file
       logging.basicConfig(filename="debug.log", encoding='utf-8', 
level=logging.DEBUG)
       client = Client()
       client.run()
       client.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.

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


Reply via email to