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

[python] ApplicationEvent causing memory growth

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: proton-c-0.18.1
    • Fix Version/s: proton-c-0.31.0
    • Component/s: python-binding
    • Labels:

      Description

      ApplicationEvent creates a new EventType object in the constructor. The EventType object adds itself to the TYPES dict always, even for the same typename. There is no way for the application to avoid this by providing an EventType object directly. Repro code below:

      import threading
      from proton.reactor import Container, ApplicationEvent, EventInjector
      
      class Program:
          def __init__(self, injector):
              self.injector = injector
      
          def on_reactor_init(self, event):
              event.reactor.selectable(self.injector)
      
          def on_hello(self, event):
              print(event.subject)
      
          def on_done(self, event):
              event.subject.stop()
      
      e = EventInjector()
      r = Container(Program(e))
      t = threading.Thread(target=r.run)
      t.start()
      
      for i in range(1, 10000000):
          e.trigger(ApplicationEvent("hello", subject=str(i)))
      
      e.trigger(ApplicationEvent("done", subject=r))
      
      t.join()
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                astitcher Andrew Stitcher
                Reporter:
                xinchen Xin Chen
              • Votes:
                2 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: