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


   OK, I modified my code to the following:
   ```
   import pulsar
   import logging
   
   logging.basicConfig(filename='debug.log', level=logging.DEBUG)
   clients = []
   
   def log(m):
       logging.debug(m)
   
   def get_producer():
       try:
           cl = pulsar.Client(
               'pulsar://localhost:6650',
               operation_timeout_seconds=1,
               connection_timeout_ms=1000,
               logger=logging.getLogger(),
           )
           clients.append(cl)  # intentionally leak clients on reconnect to 
prevent segfaults per https://github.com/apache/pulsar/issues/6463
           log('Creating producer')
           rv = cl.create_producer('foobar', send_timeout_millis=1000)
           log('Created producer')
           return rv
       except Exception as e:
           log('Error creating producer: {}'.format(e))
           raise
   
   
   producer = get_producer()
   sent = 0
   while True:
       try:
           producer.send(b'foo')
           sent += 1
           if sent % 1000 == 0:
               log('Sent: {}'.format(sent))
       except Exception as e:
           log('Got exception: {}'.format(e))
           producer = get_producer()
   ```
   
   I ran once with a running broker that was SIGSTOPped. The kill command was 
`pkill -SIGSTOP -f pulsar; echo -e '\nKILLED HERE\n' >> debug.log`, so the logs 
should contain that string when it happened.
   
   Here is the debug log file (I waited a couple minutes before shutting down 
my script):
   
   [debug.log](https://github.com/apache/pulsar/files/7091645/debug.log)
   
   And here is the debug log (emptied out from the previous test) run when 
attempting to start my script against an already SIGSTOPped broker:
   
   [debug.log](https://github.com/apache/pulsar/files/7091686/debug.log)
   
   
   


-- 
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: [email protected]

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


Reply via email to