qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xin Chen (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (PROTON-1709) Python binding: ApplicationEvent causing memory growth
Date Fri, 01 Dec 2017 22:58:00 GMT

     [ https://issues.apache.org/jira/browse/PROTON-1709?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Xin Chen updated PROTON-1709:
-----------------------------
    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:

{code:java}
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()
{code}



  was:
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()



> Python binding: ApplicationEvent causing memory growth
> ------------------------------------------------------
>
>                 Key: PROTON-1709
>                 URL: https://issues.apache.org/jira/browse/PROTON-1709
>             Project: Qpid Proton
>          Issue Type: Bug
>          Components: python-binding
>    Affects Versions: proton-c-0.18.1
>            Reporter: Xin Chen
>
> 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:
> {code:java}
> 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()
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


Mime
View raw message