MQ

MQ

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Memory leak on connection (MQCONNX) failure when `cd.SSLCipherSpec` is used

    Posted Mon June 22, 2020 04:48 PM
      |   view attached
    Hi,

    While using the python library `pymqi` we discovered that there is possibly a memory leak with `MQCONNX` when `cd.SSLCipherSpec` is specified and the connection fails.

    I used `@profile` from [memory-profiler](https://pypi.org/project/memory-profiler/) for the profiling.

    As you can see in the profiling results, the memory increases with each call to `QueueManager .connect_with_options` with then call `MQCONNX`.

    You can reproduce by running the `con_leak.py` (attached) script using `python -m memory_profiler con_leak.py`.

    Line #    Mem usage    Increment   Line Contents
    ================================================
         5  38.3828 MiB  38.3828 MiB   @profile(precision=4)
         6                             def profiled_connect():
         7  38.3828 MiB   0.0000 MiB       cd = pymqi.CD()
         8  38.3828 MiB   0.0000 MiB       cd.ChannelName = b'abc'
         9  38.3828 MiB   0.0000 MiB       cd.ConnectionName = b'abc'
        10  38.3828 MiB   0.0000 MiB       cd.ChannelType = pymqi.CMQC.MQCHT_CLNTCONN
        11  38.3828 MiB   0.0000 MiB       cd.TransportType = pymqi.CMQC.MQXPT_TCP
        12  38.3828 MiB   0.0000 MiB       cd.Version = 6
        13  38.3828 MiB   0.0000 MiB       cd.SSLCipherSpec = b'mycypher'
        14                             
        15  38.3828 MiB   0.0000 MiB       sco = pymqi.SCO()
        16  38.3828 MiB   0.0000 MiB       sco.KeyRepository = b'my_location'
        17                             
        18  38.3828 MiB   0.0000 MiB       queue_manager = pymqi.QueueManager(None)
        19                             
        20  42.5273 MiB   4.1445 MiB       connect_with_options(cd, queue_manager, sco)
        21  42.6328 MiB   0.1055 MiB       connect_with_options(cd, queue_manager, sco)
        22  42.6562 MiB   0.0234 MiB       connect_with_options(cd, queue_manager, sco)
        23  42.6797 MiB   0.0234 MiB       connect_with_options(cd, queue_manager, sco)
        24  42.7344 MiB   0.0547 MiB       connect_with_options(cd, queue_manager, sco)
        25  42.7969 MiB   0.0625 MiB       connect_with_options(cd, queue_manager, sco)
        26  42.8281 MiB   0.0312 MiB       connect_with_options(cd, queue_manager, sco)
        27  42.8555 MiB   0.0273 MiB       connect_with_options(cd, queue_manager, sco)
        28  42.8789 MiB   0.0234 MiB       connect_with_options(cd, queue_manager, sco)
        29  42.9023 MiB   0.0234 MiB       connect_with_options(cd, queue_manager, sco)
        30  45.6328 MiB   0.0000 MiB       for i in range(100):
        31  45.6328 MiB   0.0547 MiB           connect_with_options(cd, queue_manager, sco)
        32  72.3320 MiB   0.0000 MiB       for i in range(1000):
        33  72.3320 MiB   0.0781 MiB           connect_with_options(cd, queue_manager, sco)​


    As you can see, each call to `connect_with_options` will increment the total memory used.

    Test environment info:

    Using the same script shared above. The mem leak happen on:
    - OSX with IBM MQ Client 9.1.3.0
    - REHL 7.8 with IBM MQ Client 9.1.3.0

    It does NOT happen on:
    - Ubuntu 16.04 with IBM MQ Client 9.1.3.0


    More details and discussion can be found on this GitHub issue:  https://github.com/dsuch/pymqi/issues/208 



    ------------------------------
    Alexandre YANG
    ------------------------------

    Attachment(s)

    py
    con_leak.py   1 KB 1 version


  • 2.  RE: Memory leak on connection (MQCONNX) failure when `cd.SSLCipherSpec` is used

    Posted Mon June 22, 2020 09:58 PM
    It would appear from the GitHub discussion that you have found a small storage leak when making hundreds of failing SSL/TLS client connections. Thank you for letting the MQ User community know by posting here. Please also raise a case/PMR with IBM in order to get it fixed. This is a user community, which happens to have a number of IBMers who read and answer posts too, but it is not a way to get a fix from IBM for the problem.

    ------------------------------
    Morag Hughson
    MQ Technical Education Specialist
    MQGem Software Limited
    ------------------------------



  • 3.  RE: Memory leak on connection (MQCONNX) failure when `cd.SSLCipherSpec` is used

    Posted Wed June 24, 2020 06:32 AM
    Please also raise a case/PMR with IBM in order to get it fixed.

    It seems I can't create a case/PMR since I'm not using the MQ product myself (I can't select any product):


    ------------------------------
    Alexandre YANG
    ------------------------------