0

I have the following environment:

  • Redhat
  • Python 2.7

I have a module which reads messages from an IBM MQ and then process them. The scenarios is as follows:

  1. Start the application
  2. Simulate connection is lost with the VM where the IBM MQ resides by issuing ifdown eth0 command
  3. As expected the connection is lost

Expected behavior:

  • An pymqi.MQMIError being raised

Observed behavior:

  • All the pymqi calls just get blocked. The running thread does nothing unless the connection is enabled again with ifup.

This is part of the code:

def connect_and_subscribe(self):
    """Connect to IBM MQ and subscribe"""
    self.qmgr         = pymqi.connect(self.qmgr_name, self.qmgr_channel, self.qmgr_connect)
    self.queue        = pymqi.Queue(self.qmgr, self.queue_name)
    self.queue_i      = pymqi.Queue(self.qmgr, self.queue_name)
    self.queue_i_type = self.queue_i.inquire(pymqi.CMQC.MQIA_Q_TYPE)
    self.connected    = True
    logging.info('CONNECTED TO MQ USING PYMQI VERSION <%s>' % (pymqi.__version__))
    return

#--------------------------------------------------------------------

    m = None
    # Message Options
    gmo = pymqi.GMO()
    gmo.Options = pymqi.CMQC.MQGMO_WAIT | pymqi.CMQC.MQGMO_FAIL_IF_QUIESCING | pymqi.CMQC.MQPMO_SYNCPOINT
    gmo.WaitInterval = self.max_cycle_wait_secs * 1000

    while True:
        try:
            m = None
            md = pymqi.MD()
            m = self.queue.get(None, md, gmo)
            self.queue.commit()

        except pymqi.MQMIError as e:
            if e.reason == pymqi.CMQC.MQRC_NO_MSG_AVAILABLE:

          .....

Any ideas?

JoshMc
  • 10,239
  • 2
  • 19
  • 38
  • What version of MQ client is installed? How long do you wait while it blocks before you ifup the interface? Have you ever waited more than 6 minutes? If not try it. – JoshMc Aug 21 '18 at 10:26
  • I have pymqi 1.3. I have not tried to wait for more than 30 secs. I will try to see what happens if I wait for more than 6 minutes. Thanks. – Cosmin Costache Aug 21 '18 at 10:51
  • Actually wanted to know the IBM MQ client version. Pymqi requires the MQ client from IBM. To recover quicker from the situation you describe you need to set the HBINT lower on both the client side and the SVRCONN channel. 15 seconds will get you a 30 second timeout if you are at a v7.0.1.0 or higher version of MQ on both client and server and SHRCONV is at least 1. – JoshMc Aug 21 '18 at 10:59
  • Thanks for the hint. – Cosmin Costache Aug 21 '18 at 14:20
  • Can you provide the MQ client version. If you have it installed on your server you can run the dspmqver (Linux /opt/mqm/bin/dspmqver) on windows bin directory under the MQ install location. If you are using one of the newer Redist clients it will be in the bin directory where ever you extracted the files (Linux tar or Windows zip). I'll write up a answer now that I'm at my computer. – JoshMc Aug 21 '18 at 14:45
  • WebSphere MQ Client version is 7.5. The server side will be with the customer. I will not have access to it. I have lowered Hearbeat Interval on Client and server side and it works. In the real life I do not have access to the server side and from what I can see it if I set the HBINT to 300 on the server side it does not matter what value I set on the client side. – Cosmin Costache Aug 21 '18 at 14:52
  • That is correct, all you can do is ask/explain that in order for MQ to detect a network issue as soon as possible that the IBM default of 300 from 20 years ago is no much too high. if it is less than 60 the timeout is 2*HBINT, if it is 60 or greater the timeout is HBINT+60. Any MQ Admin that understands the technology should be willing to set this lower, it will benefit them as well since they will clear up defunct channel processes sooner. – JoshMc Aug 21 '18 at 15:59
  • Note that 7.5 went out of support April of this year. You can connect to higher or lower version of a MQ queue manager from a MQ client, so it would be advised to go with something higher like 9.0.0.4. This version of the client comes as a redistributable file you can just extract (Linux tar, Windows zip). Google MQC9 for the download link. – JoshMc Aug 21 '18 at 16:02

0 Answers0