You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Jiri Daněk (Jira)" <ji...@apache.org> on 2020/04/08 15:35:01 UTC

[jira] [Updated] (PROTON-2111) python: memory leak on Container, SSL, and SSLDomain objects

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

Jiri Daněk updated PROTON-2111:
-------------------------------
    Fix Version/s: proton-c-0.30.0

> python: memory leak on Container, SSL, and SSLDomain objects
> ------------------------------------------------------------
>
>                 Key: PROTON-2111
>                 URL: https://issues.apache.org/jira/browse/PROTON-2111
>             Project: Qpid Proton
>          Issue Type: Bug
>          Components: python-binding
>    Affects Versions: proton-c-0.28.0
>            Reporter: Chenxiong Qi
>            Assignee: Clifford Jansen
>            Priority: Major
>             Fix For: proton-c-0.30.0
>
>
> 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.
> {noformat}
> 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']))
> {noformat}
> 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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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