'pymqe.error', 'MQGMO wrong size. Given: 112, expected 108'‏

Bug #971600 reported by Y.C. Lu
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
PyMQI
New
Undecided
Unassigned

Bug Description

Nice work for PyMQI. I have successfully tested on Win32 machine (XP,
Python 2.7.2, pymqi-1.2.win32-py2.7-mq-7.0-client.exe) for the below code.
However, when I run it on x64 machine (Windows 2008, Python 2.7.2,
pymqi-1.2.win-amd64-py2.7-mq-7.0-client.exe). I met 'pymqe.error', 'MQGMO
wrong size. Given: 112, expected 108'. The error occurs at the line: sTXMsgReply = replyto_queue.get(None, get_mqmd, get_opts)

Would you please give me a hand? Is it a bug? Would you please help me to find a workaround? Thanks a lot in
advance.

#-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: Administrator
#
# Created: 02/04/2012
# Copyright: (c) Administrator 2012
# Licence: <your licence>
#-------------------------------------------------------------------------------

# PyMQI
import pymqi, CMQC, sys, uuid
import xml.dom.minidom

def send_receive(sQueueName, sTXMessage, nTimeout):
    """ Send & reeive MQ Transactions to & from the specified server.
    Return: nReturnCode, sReturnMsg, sTXreplyMsg (string) """

try:

    # Give qm_name, channel_name, connect_onfo
    qmgr = pymqi.connect('MESQM01T', 'MESQM01T.SVRCONN','10.182.128.22(1426)')
    replyto_queue_name = 'SHARE.REPLY'

    # Get the put_queue
    put_queue = pymqi.Queue(qmgr, sQueueName)

    # Put the request message.
    put_mqmd = pymqi.MD()

    # Set the MsgType to request.
    put_mqmd["MsgType"] = CMQC.MQMT_REQUEST

    # Set up the ReplyTo QUeue/Queue Manager (Queue Manager is automatically
    # set by MQ).
    put_mqmd["ReplyToQ"] = replyto_queue_name
    put_mqmd["ReplyToQMgr"] = 'MESQM01T'

    # Generate a random number in MsgId and CorrelId to ensure transaction
    # integrity.
    put_mqmd["MsgId"] = str(uuid.uuid4().hex)
    put_mqmd["CorrelId"] = put_mqmd["MsgId"]

    # Set up the put options - must do with NO_SYNCPOINT so that the request
    # message is committed immediately.
    put_opts = pymqi.PMO(Options=CMQC.MQPMO_NO_SYNCPOINT +
    CMQC.MQPMO_FAIL_IF_QUIESCING)

    # Put queue; send TX message
    put_queue.put(sTXMessage, put_mqmd, put_opts)

    # Set up message descriptor for get.
    get_mqmd = pymqi.MD()

    # Set the exact same values of MsgId and CorrelId.
    get_mqmd["MsgId"] = put_mqmd["MsgId"]
    get_mqmd["CorrelId"] = put_mqmd["CorrelId"]

    # Set up the get options.
    get_opts = pymqi.GMO(Options=CMQC.MQGMO_NO_SYNCPOINT +
    CMQC.MQGMO_FAIL_IF_QUIESCING +
    CMQC.MQGMO_WAIT)

    # Version must be set to 2 to correlate.
    get_opts["Version"] = CMQC.MQGMO_VERSION_2

    # Tell MQ that we are matching on CorrelId.
    get_opts["MatchOptions"] = CMQC.MQMO_MATCH_CORREL_ID

    # Set the wait timeout of half a second.
    get_opts["WaitInterval"] = int(nTimeout*1000)

    # Open the replyto queue and get response message,
    replyto_queue = pymqi.Queue(qmgr, replyto_queue_name,
    CMQC.MQOO_INPUT_SHARED)
    sTXMsgReply = replyto_queue.get(None, get_mqmd, get_opts)

    except pymqi.MQMIError, e:
        return 1, e, None

    except:
        return 2, sys.exc_info(), None

    else:
        return 0, 'Successful!', sTXMsgReply

if __name__ == '__main__':
    #Give a wafer Id
    sWaferId='ES90211.15'

    #Call TX
    tx_msg="""<transaction><trx_id>APINQSHT</trx_id><type_id>I</type_id>
<sht_id>{0}</sht_id></transaction>""".format(sWaferId)
    nReturnCode, sReturnMsg, oTXMsgReply = send_receive('APINQSHTI', tx_msg, 5)

    print nReturnCode, sReturnMsg
    print oTXMsgReply

>>>
2 (<class 'pymqe.error'>, error('MQGMO wrong size. Given: 112, expected
108',), <traceback object at 0x0000000002FC9C48>)
None

Revision history for this message
Dariusz Suchojad (dsuch) wrote :

Hi there,

thanks for the nice words and can you please tell me a couple of things?

- What is the exact version of MQ on both systems as returned by the dspmqver command?
- What is the Python version on the systems? For instance, what is the welcome banner when you run the Python shell?

Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53)
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

This error means there's a version mismatch between PyMQI, the Windows bit-ness and the MQ version so the thing to do is to chase the component that's off.

Also, as an aside, if you're going to process a lot of XML documents, you may want to have a look at http://lxml.de - this should be at least an order of magnitude faster a toolkit.

Cheers!

Revision history for this message
Y.C. Lu (ycluc) wrote : Re: [Bug 971600] Re: 'pymqe.error', 'MQGMO wrong size. Given: 112, expected 108'‏
Download full text (9.1 KiB)

Hi,

Very pleased for such fast response! Thanks!

MQ version of server:
C:\Users\Administrator>dspmqver
Name: WebSphere MQ
Version: 7.0.1.2
CMVC level: p701-102-100504
BuildType: IKAP - (Production)

MQ version of client:
C:\Users\ycluc.TSMCSSL>dspmqver
Name: WebSphere MQ
Version: 7.0.0.1
CMVC level: p700-001-090115
BuildType: IKAP - (Production)

Python version:
Python 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)]
on win32

Thanks for your recommendation about XML processing.

Regards,
Lu, Yuan-Ching/盧元慶
Computer Integrated Manufacturing Department,
Manufacturing Operation, TSMC Solid State Lighting Ltd.
Tel: 886-3-5636688 Ext: 781-3057
Mobile: 886-938-317596
<email address hidden>

|------------------------------------->
| <email address hidden> |
| |
| |
| Sent by: |
| <email address hidden> |
| |
| |
| 2012/04/02 下午 11:25 |
| |
| |
| Please respond to |
| Bug 971600 |
| <<email address hidden>|
| t> |
| |
|------------------------------------->
  >------------------------------------------------------------------------------------------------------------------|
  | |
  | |
  | To|
  | <email address hidden> |
  | cc|
  | |
  | Subject|
  | [Bug 971600] Re: 'pymqe.error', 'MQGMO wrong size. Given: 112, expected 108'‏ |
  | |
  | |
  | |
  | |
  | |
  >---------------------------------------------...

Read more...

Revision history for this message
Dariusz Suchojad (dsuch) wrote :

> Python version:
> Python 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)]
> on win32

Hmmm.. this looks weird. Why is it a 'win32' ? What does the following return for you when you run in in the Python shell? It should be 8 for a 64-bit system/Python build. Can you please make sure it is?

>>> import struct
>>> struct.calcsize('P')
8
>>>

PS. I will have only sporadic access to the net, if at all, for about a week now.

Revision history for this message
Dariusz Suchojad (dsuch) wrote :

Another thing is, before we proceeed, can you please make sure the MQ installation
is up to date? 7.0.0.1 is quite an old version.

Also, can you please uninstall pymqi-1.2.win-amd64-py2.7-mq-7.0-client.exe and
try pymqi-1.2.win32-py2.7-mq-7.0-client.exe instead? It's a wild guess but maybe
the Windows is a 64-bit one, so is MQ, but Python itself isn't? Let's check it out.

Revision history for this message
Y.C. Lu (ycluc) wrote :
Download full text (8.2 KiB)

Thanks a lot for help. The below is the output of Python (installed on
Windows 2008 with python-2.7.2.amd64.msi):

Microsoft Windows [版本 6.0.6001]
Copyright (c) 2006 Microsoft Corporation. All rights reserved.

C:\Users\Administrator>python
Python 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import struct
>>> struct.calcsize('P')
8
>>>

Regards,
Lu, Yuan-Ching/盧元慶
Computer Integrated Manufacturing Department,
Manufacturing Operation, TSMC Solid State Lighting Ltd.
Tel: 886-3-5636688 Ext: 781-3057
Mobile: 886-938-317596
<email address hidden>

             <email address hidden>

                                                                                                                       To
             Sent by: <email address hidden>
             <email address hidden> cc

                                                                                                                  Subject
             2012/04/03 下午 02:45 [Bug 971600] Re: 'pymqe.error', 'MQGMO wrong size. Given: 112, expected
                                               108'

                 Please respond to
                    Bug 971600
             <<email address hidden>
                        t>

> Python version:
> Python 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)]
> on win32

Hmmm.. this looks weird. Why is it a 'win32' ? What does the following
return for you when you run in in the Python shell? It should be 8 for a
64-bit system/Python build. Can you please make sure it is?

>>> import struct
>>> struct.calcsize('P')
8
>>>

PS. I will have only sporadic a...

Read more...

Revision history for this message
Y.C. Lu (ycluc) wrote :
Download full text (8.8 KiB)

We have upgraded MQ to 7.0.1.0. The same error is still over here.

C:\Users\Administrator>dspmqver
Name: WebSphere MQ
Version: 7.0.1.0
CMVC level: p000-L090813
BuildType: IKAP - (Production)

I failed to install pymqi-1.2.win32-py2.7-mq-7.0-client.exe because it
looks for 32-bit Python 2.7 in system registry. (The installed Python is
64-bit version which is in 64-bit system registry) I attached the screen
sanpshot of error message for your reference.
(Embedded image moved to file: pic09429.jpg)

The attach files is my test script. I hope it save your time to repeat my
case.
 (See attached file: testTX.py)

My current workaround is to build a x86 application distribution pack by
using py2exe in a x86 box (Win XP), then distribute that x86 pack to the
x64 box (Windows 2008 server) that is enabled WOW64 layer. It works!
However, I still expect a native 64-bit solution for better performance and
future compatibility.

I would like to express my deep appreciation to your great work for PyMQI
that makes Python really powerful in our production environment.

Regards,
Lu, Yuan-Ching/盧元慶
Computer Integrated Manufacturing Department,
Manufacturing Operation, TSMC Solid State Lighting Ltd.
Tel: 886-3-5636688 Ext: 781-3057
Mobile: 886-938-317596
<email address hidden>

             <email address hidden>

                                                                                                                       To
             Sent by: <email address hidden>
             <email address hidden> cc

                                                                                                                  Subject
             2012/04/03 下午 03:25 [Bug 971600] Re: 'pymqe.error', 'MQGMO wrong size. Given: 112, expected
                                               108'

                 Please respond to
                    Bug 971600
             <<email address hidden>
                        t>
            ...

Read more...

Revision history for this message
Jonas Nilsson (jonas-olov-nilsson) wrote :

I ran in to the same bug: MQGMO wrong size. Given: 112, expected 108

Traceback: Traceback (most recent call last):
  File "pyMQService.py", line 177, in mq_get
    message = get_queue.get(None, mq_md, mq_gmo)
  File "E:\SYSAPP\Program Files\Python26\lib\site-packages\pymqi.py", line 1592, in get
    mDesc.pack(), getOpts.pack(), length)
error: MQGMO wrong size. Given: 112, expected 108

But only for the Windows 64-bit version and not with the Windows 32-bit. The tests are done on the same HP machine: Windows Server 2008 R2 Enterprise. Service Pack 1. 64-bit OS Intel Xeon CPU E5620@2.40GHz (2processors)

The error/bug appears when I'm using:

WebSphere MQ version is [7.0.1.6].
C:\>dspmqver
Name: WebSphere MQ
Version: 7.0.1.6
CMVC level: p701-106-110725
BuildType: IKAP - (Production)

Python 2.6.6 (r266:84297, Aug 24 2010, 18:13:38) [MSC v.1500 64 bit (AMD64)] on win32

pymqi-1.2.win-amd64-py2.6-mq-7.0-client.exe
Version: 1.2
Built Tue Mar 15 00:47:09 2011 with distutils-2.6.6

However, when I use the following set up everything works fine:

WebSphere MQ version is [7.0.1.6]. (The same MQ!)
Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)] on win32
pymqi-1.2.win32-py2.6-mq-7.0-client.exe
Version 1.2
Built Sat Apr 09 11:09:47 2011 with distutils-2.6.6

The Python code goes something like...

cd = pymqi.CD()
cd.ChannelName = channel
cd.ConnectionName = conn_info
cd.ChannelType = CMQC.MQCHT_CLNTCONN
cd.TransportType = CMQC.MQXPT_TCP
cd.SSLCipherSpec = "TLS_RSA_WITH_AES_256_CBC_SHA"

sco = pymqi.SCO()
sco.KeyRepository = ssl_key_location

qmgr = pymqi.QueueManager(None)
qmgr.connect_with_options(queue_manager, cd, sco)

mq_md = pymqi.md()

mq_gmo = pymqi.gmo( Options = CMQC.MQGMO_BROWSE_NEXT )
mq_gmo.WaitInterval = CMQC.MQWI_UNLIMITED

get_queue = pymqi.Queue(qmgr)
get_queue.open(queue_name_get, CMQC.MQOO_BROWSE)

message = get_queue.get(None, mq_md, mq_gmo)

Unfortunately I cannot change the MQ installation or upgrade the Python version to 2.7. So the workaround for me is to use the 32-bit version of Python and PyMQI.

Unless you have some other solution for the 64-bit version of PyMQI.

Many thanks,

Jonas

Revision history for this message
Rob Nichols (0x2jjt-rob-0tlbog) wrote :

I see the same issue. Works with 32-bit, fails with 'MQGMO wrong size. Given: 112, expected 108'‏ on 64-bit.

Is this related to Bug #744237?

Thanks,
Rob

P.S. Thanks very much for PyMQI. It's been very useful for me!

Revision history for this message
Dariusz Suchojad (dsuch) wrote :

> I see the same issue. Works with 32-bit, fails with 'MQGMO wrong size.
> Given: 112, expected 108'‏ on 64-bit.
>
> Is this related to Bug #744237?

Hi Rob!

Any anything along the lines of MQ*** wrong size. Given ***, expected
*** is to do with a mismatch between:

- MQ version your PyMQI version has been compiled with
- MQ version PyMQI is running against
- Python version your PyMQI version has been compiled for
- The CPU architecture, 32-bit vs. 64-bit

Basically, and this is due to how MQ is built, you need to use a PyMQI
version matching exactly the MQ version, down to every little bit.

For instance, you connect from Python 2.6 on a 32-bit Windows box to a
7.0 queue manager and you connect in the client mode -> you need
https://launchpad.net/pymqi/trunk/1.2/+download/pymqi-1.2.win32-py2.6-mq-7.0-client.exe

Or, you are on a 64-bit Linux and want to talk to a 64-bit queue manager
(regardless of the Python version) in client mode too -> you need to
download
https://launchpad.net/pymqi/trunk/1.2/+download/pymqi-1.2.tar.gz and
compile the package on the very same box you will be connecting with and
this system needs to have a bunch of MQ client RPM packages already
installed and they need to be exactly in the same version as that of the
queue manager.

I'm not sure if you're familiar with C MQ API but in essence, PyMQI is a
C MQI application from the queue manager's viewpoint and in accordance
with IBM docs, both sides of the communication need to be on the same
level with regards to everything.

I know it may sometimes work if clients and queue managers use different
versions but this may as well be regarded as a pure coincidence and
indeed, can lead to nasty surprises during upgrades of either side. But
here I digress :-)

In any case, can you please confirm everything is using the same MQ
version? What is your OS? Is it a 32-bit or a 64-bit one? Have you
compiled PyMQI yourself or it's one of the precompiled binaries?

Thanks!

Revision history for this message
Dariusz Suchojad (dsuch) wrote :

I've just released PyMQI 1.3 and the development effort has moved to GitHub - https://github.com/dsuch/pymqi

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.