Author |
Message
|
sinner59 |
Posted: Fri Mar 04, 2005 8:42 am Post subject: Reason code 2219 on MQCONN or MQCONNX |
|
|
 Newbie
Joined: 04 Mar 2005 Posts: 7 Location: France
|
Hi all,
I'm using MQ this way to communicate from a website to an as400:
The request and reply queue are on the as400, the website only have the mq client.
Everytime I do the following all process:
MQCONN
MQOPEN request queue
MQOPEN reply queue
MQPUT my request
MQCLOSE request queue
MQGET with WAIT my reply
MQCLOSE reply queue
MQDISC
The problem is that I sometime get MQCC_FALILED on MQCONN with reason code 2219.
I think maybe I did not uses MQ the right way. Do I ?
This shoulb be meaning that a queue manager can only be accessed with 1 unique connection?
Thanks in advance for your help and answer.
Sinn'
 |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Mar 04, 2005 10:27 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You don't say what programming language you have written your web program in.
What you can do to fix this problem depends on how you have written your web site and in what language.
But you should never ever code an application to connect, open, do one thing, close, disconnect. Connect and disconnect are expensive. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
zpat |
Posted: Sat Mar 05, 2005 4:19 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
The ideal way to handle web site requests is to code an adapter that starts a number of threads which each open a MQ client connection and handle message requests as needed from the web application.
A single client connection might not give enough scalability but you also don't want a flood of web hits causing too many connections at once.
Keeping a connection open also means you need to handle situations like the queue manager restarting and so on, it does complicate the logic.
It depends how many connections per minute/second you are expecting as to whether the simple design you have used is OK.
Another solution is to host a queue manager on the web server which stops the overhead of MQCONN elsewhere. |
|
Back to top |
|
 |
sinner59 |
Posted: Mon Mar 07, 2005 12:41 am Post subject: Ok, more precision |
|
|
 Newbie
Joined: 04 Mar 2005 Posts: 7 Location: France
|
I have written a PHP zend component in C that make the MQ call. The machine is a SUN solaris.
The call are done throught a sockopen/80 on a PHP page calling the zend function in the .so module.
I have several more questions:
- So, a queue manager can only handle 1 connection ?
- Is it safe to MQCONNX a queue manager and keep this connection for long and then do several open, get, put ?
- I suppose if something is wrong in the connection an MQOPEN will fail.
In summary, the better way to solve this is:
- MQCONNX and store the HCON somewhere
- then use it for all call:
- OPEN + PUT + CLOSE
- OPEN + GET +CLOSE
- is it useful then to disconnect then, or shoul I disconnect only if an MQOPEN fail ?
Thanks.
Regards. |
|
Back to top |
|
 |
zpat |
Posted: Mon Mar 07, 2005 12:49 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
Any given MQ connection should only be used by one thread at a time (and presumably the thread that opened it - but I am not a C programmer).
You can open as many MQ client connections as you wish, up to the limit set in the queue manager. However there is no point in having more connections than the active number of threads.
It is also wise to set an upper limit so that one web server does not monopolise the queue manager resources. We often set a limit of 10 or 20 client connections for a single application server. This is imposed only by the application code, not by MQ itself. |
|
Back to top |
|
 |
sinner59 |
Posted: Mon Mar 07, 2005 1:37 am Post subject: |
|
|
 Newbie
Joined: 04 Mar 2005 Posts: 7 Location: France
|
So it is possible that my 2219 trouble is the result of a missconfiguration of the queue manager ?
I do not have access to the queue manager (remote third party maintenance for queue manager and queue on AS400).
I will consult the MQ doc, but what parameter should they set to enable many connection ?
Thanks. |
|
Back to top |
|
 |
zpat |
Posted: Mon Mar 07, 2005 3:42 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
No, 2219 does not indicate that QM max client connections has been reached.
There is not a QM parameter to allow concurrent connections - there is a QM parameter of the max number of client channel connections - read the extensive IBM documentation.
Besides your original code did not keep the connection open - other than for the WAIT interval on the GET (which I assume you set a sensible wait limit eg 30 seconds).
2219 means:
The application issued an MQI call whilst another MQI call was already being processed for that connection. Only one call per application connection can be processed at a time. Concurrent calls can arise when an application uses multiple threads, or when an exit is invoked as part of the processing of an MQI call. For example, a data-conversion exit invoked as part of the processing of the MQGET call may try to issue an MQI call. |
|
Back to top |
|
 |
sinner59 |
Posted: Mon Mar 07, 2005 5:19 am Post subject: |
|
|
 Newbie
Joined: 04 Mar 2005 Posts: 7 Location: France
|
I have difficulties to understand what's wrong. I'm really new to MQ this is maybe the reason.
Let's imagine the maxclientconnection=4. Why can't I MQCONNX 4 times ?
What exaclty is a concurrent connection? I mean, I understand it as we are between a succesful MQCONNX and before a MQDISC, wrong ? So I consume 1 connection. Everytime I call my php page (so my c zend module) it's a new instance, no ?
I have difficulties to understand what happens exaclty when the doc say "Concurrent calls can arise when an application uses multiple threads".
 |
|
Back to top |
|
 |
zpat |
Posted: Mon Mar 07, 2005 6:53 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
The default max client channels is 200 I believe. You have probably not reached this limit (unless your code is failing to disconnect).
You can display the number of concurrently active client channels on the queue manager.
I believe you can only have one active connection to MQ per program thread.
Time to read the manuals and get a better understanding of MQ architecture perhaps, it's unlikely to be a problem with MQ since thousands of sites are using it. |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Mar 07, 2005 6:56 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Web applications are usually multi-threaded.
Likely, your code is not thread safe.
You should read the documentation on PHP components to see what it says about threads and reentrant code.
Then understand how to change your program so that only one MQ connection is used in each thread. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
sinner59 |
Posted: Mon Mar 07, 2005 8:17 am Post subject: Ok |
|
|
 Newbie
Joined: 04 Mar 2005 Posts: 7 Location: France
|
I'm going back to the doc.
Thanks for your help guys.
 |
|
Back to top |
|
 |
sinner59 |
Posted: Wed Apr 06, 2005 7:01 am Post subject: still get 2219 |
|
|
 Newbie
Joined: 04 Mar 2005 Posts: 7 Location: France
|
Hi again,
I have the following situation:
My MQ machine, hosting the MQ client API is free of any call except my testing ones.
- I make a call to an as400 n°1 within the phpmodule all is ok
- I make another call with an other as400 n°2, (so different IP, QMan, and Queue) and I get a 2219 directly !
- I make another call with an other as400 n°3, (so different IP, QMan, and Queue) and I get a 2219 sometimes !
So I mean this is probably not a problem with the module.
Any clue ?
Thx.
 |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Apr 06, 2005 7:06 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
It may not exactly be a problem with your module.
But it may be a problem with how your module is being used.
You can't make more than one queue manager connection in the same thread.
Your module may being called multiple times from the same thread to connect to different queue managers. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
sinner59 |
Posted: Thu Apr 07, 2005 12:16 am Post subject: |
|
|
 Newbie
Joined: 04 Mar 2005 Posts: 7 Location: France
|
The AS400 is stopped for maintenance and then restarted.
It seems that when this occurs we get a reason code 2259 and then when the 2219 starts.
---
I have 2 MQ machines, let's call them MQ1 and MQ3:
- each have an apache + PHP + my module
- I call the same distant AS400 Queue Manager
The MQ3 machine always send a 2219 and the MQ1 only sometimes.
but MQ3 is free of any other call except those I make for testing.
BTW: About thread, on unix it means a PID ?
So, when I call my php page on MQ3, my module call the MQ API and it represent one thread, I am right ?
So if I have another call to my pageon MQ1, it's another thread calling another MQ API and so my distant QM?
I really don't understand what's wrong.
What may be happen on MQ1 for example is that apache + PHP represent one unique thread (I'm not sure of that).
1) this thread call the MQ API
2) another call from PHP raise up and call also the MQ API and he get a 2219 reason code as a call is already in progress on the same QManager
That could be this ?
Thanks. |
|
Back to top |
|
 |
|