Memory Leak ?

Asked by Joan

Hi,

I'm having a problem using pymqi (1.0) to write some scripts that retrieve some information from MQ servers. Not sure 100% if related to a memory leak or a mistake of mine, but when I execute the following code it seems that some memory is not released:

This is an extract of the code, to retrieve the information from channels.

...
while True:
  op=mq.cd()
  ref = qm.connectTCPClient("QM_NAME", op, "CHANNEL", "SERVER(PORT)")
  pcf = mq.PCFExecute(qm)

  # Next one is the line wich gets memory: if commented, memory doesn't grow
   channels = pcf.MQCMD_INQUIRE_CHANNEL_STATUS({CMQCFC.MQCACH_CHANNEL_NAME : "*"})

   # Process information, name, status, ...

  del channels
  del pcf
  del ref
  del op
....

Of course this is not exactly the code I'm using on the scripts, probably I don't even need the deletes, but my code also involves an infinite loop for monitoring some stuff (queues depth and more). When executing the previous code I get the python.exe process memory growing until reaches aprox 2GB and then crashes.

Am I missing something ?

Other information is: reproduced with both pymqi 0.5d and 1.0, in a Windows 2003 system as MQ client. Targets systems are MQ 6 and 7 in different platforms (Win, Linux, iSeries). pymqi compiled with MQ client version 6.0.27 and MinGW

Any ideas ? Thank you for your time.

regards,
Joan

Question information

Language:
English Edit question
Status:
Solved
For:
PyMQI Edit question
Assignee:
No assignee Edit question
Solved by:
Dariusz Suchojad
Solved:
Last query:
Last reply:
Revision history for this message
Dariusz Suchojad (dsuch) said :
#1

> When executing the previous code I get the python.exe process memory growing
> until reaches aprox 2GB and then crashes.

Hi Joan,

thanks for reporting it. I've been able to reproduce it with the following code, can you please try it and tell me whether it also exhibits the erroneous behaviour on your system? I'd like to make sure we will be using the very same code when we'll be resolving the issue. I'm testing it on Linux with PyMQI 1.0 and WMQ 7.0 so it looks like the culprit lies somewhere in the PCF (MQAI, really) implementation.

Are there any errors on MQ end? Anything in the queue manager logs?

Thanks!

"""
import CMQCFC
import pymqi as mq

qm_name = "QM01"
channel = "SVRCONN.1"
conn_info = "192.168.1.121(1435)"

op = mq.cd()
qm = mq.QueueManager(None)
ref = qm.connectTCPClient(qm_name, op, channel, conn_info)
pcf = mq.PCFExecute(qm)

while True:
    channels = pcf.MQCMD_INQUIRE_CHANNEL_STATUS({CMQCFC.MQCACH_CHANNEL_NAME : "*"})

qm.disconnect()
"""

Revision history for this message
Dariusz Suchojad (dsuch) said :
#2

One more question - what Python version is that? I'm using 2.6.2

Python 2.6.2 (release26-maint, Apr 19 2009, 01:58:18)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

Revision history for this message
Joan (jblanch) said :
#3

Hi, thank you for your quick reply!

I tested your code and get same results, memory usage is growing.

The code is not generating any errors, and couldn't see any errors on the server part.

About python version it is: Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] on win32 (can't update Python version at this moment)

don't hesitate to contact me if you need further info

best regards,
Joan

Revision history for this message
Best Dariusz Suchojad (dsuch) said :
#4

Looks like a bug, opened a bug report here https://bugs.launchpad.net/pymqi/+bug/507617

Revision history for this message
Joan (jblanch) said :
#5

Thanks Dariusz Suchojad, that solved my question.