Uploaded image for project: 'Qpid Proton'
  1. Qpid Proton
  2. PROTON-2111

python: memory leak on Container, SSL, and SSLDomain objects

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • proton-c-0.28.0
    • None
    • python-binding
    • None

    Description

      I have an application using qpid.proton to interact with ActiveMQ broker to publish messages. Following is a fake script showing an example of the app works to send a message.

      class SampleSender(proton.handlers.MessagingHandler):
      
          def __init__(self, msg_id, *args, **kwargs):
              super(SampleSender, self).__init__(*args, **kwargs)
              self.msg_id = msg_id
      
          def on_start(self, event):
              ssl_domain = proton.SSLDomain(proton.SSLDomain.MODE_CLIENT)
              ssl_domain.set_credentials(producer_config['certificate'],
                                         producer_config['private_key'],
                                         None)
              ssl_domain.set_trusted_ca_db(producer_config['trusted_certificates'])
              ssl_domain.set_peer_authentication(proton.SSLDomain.VERIFY_PEER)
      
              conn = event.container.connect(urls=producer_config['urls'],
                                             reconnect=False,
                                             ssl_domain=ssl_domain)
              event.container.create_sender(conn, target='topic://VirtualTopic.event')
      
          def on_sendable(self, event):
              msg = proton.Message(body={'msg-id': self.msg_id, 'name': 'python'})
              event.sender.send(msg)
              event.sender.close()
              event.connection.close()
      
      
      def send_msg(msg_id):
          container = proton.reactor.Container(SampleSender(msg_id))
          container.run()
      
      objgraph.show_growth()
      
      for i in range(3):
          send_msg(i + 1)
      
      new_ids = objgraph.get_new_ids()
      print(objgraph.at_addrs(new_ids['SSLDomain']))
      print(objgraph.at_addrs(new_ids['Container']))
      print(objgraph.at_addrs(new_ids['SSL']))
      

      Each time to publish a message, a new Container object is created and a new handler object is created and passed to that container. After the code runs several times, Container, SSL and SSLDomain objects remain in memory and are not collected. I use objgraph to find out those objects.

      I'm using Fedora 30 and python-qpid-proton 0.28.0.

      Attachments

        Issue Links

          Activity

            People

              cliffjansen Clifford Jansen
              cqi Chenxiong Qi
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: