Author |
Message
|
guccica |
Posted: Thu Jan 31, 2008 7:52 am Post subject: MQ Connection Timeout. |
|
|
Novice
Joined: 18 Dec 2007 Posts: 17
|
Hi All
My MQ client application which wrote in c++ was running in Linux environment able to perform correctly after it connect to MQ Server.
I able to close all its connection by calling close() and disconnect() function operation.
However, after 1 hour++ of application idle time, i found that i not able to release all my connection and it do hung.
By any chances do anyone know what is the main reason?
Do MQ having timeout process?
Thanks a lot. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Jan 31, 2008 8:04 am Post subject: Re: MQ Connection Timeout. |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
guccica wrote: |
Do MQ having timeout process? |
The channels certainly do.
There are a couple of points of relevance here:
- why was your application sitting for an hour doing nothing but holding a connection open? If it was waiting for a message consider triggering.
- as your application is a client it should be coded to deal with connection issues, which are common in this scenario. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
guccica |
Posted: Thu Jan 31, 2008 8:17 am Post subject: Re: MQ Connection Timeout. |
|
|
Novice
Joined: 18 Dec 2007 Posts: 17
|
Vitor wrote: |
guccica wrote: |
Do MQ having timeout process? |
The channels certainly do.
There are a couple of points of relevance here:
- why was your application sitting for an hour doing nothing but holding a connection open? If it was waiting for a message consider triggering.
- as your application is a client it should be coded to deal with connection issues, which are common in this scenario. |
Thanks Vitor for reply.
My application will waiting a connection in order to receive message.
According to your explanation, do u mean should i close the connection and start again in a while to search for available messages?
Hopefully will get advise due to i'm still new to MQ series...Thanks alot. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Jan 31, 2008 8:23 am Post subject: Re: MQ Connection Timeout. |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
guccica wrote: |
According to your explanation, do u mean should i close the connection and start again in a while to search for available messages?
|
No, I mean you should get MQ to start your application when a message arrives. Look up "Triggering" in the Application Programming Guide, and be aware you'll need the client trigger monitor if you persist in running the application client side.
I also urge you to arrange training at the earliest oppertunity if you're new to MQ. It's a complex product and this forum is not a teaching resource. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
guccica |
Posted: Thu Jan 31, 2008 8:31 am Post subject: Re: MQ Connection Timeout. |
|
|
Novice
Joined: 18 Dec 2007 Posts: 17
|
Vitor wrote: |
guccica wrote: |
According to your explanation, do u mean should i close the connection and start again in a while to search for available messages?
|
No, I mean you should get MQ to start your application when a message arrives. Look up "Triggering" in the Application Programming Guide, and be aware you'll need the client trigger monitor if you persist in running the application client side.
I also urge you to arrange training at the earliest oppertunity if you're new to MQ. It's a complex product and this forum is not a teaching resource. |
Thanks for the response Vitor.
However my application seems doesnt work like you say.
It will have thread awaiting messages, there will also have thread waiting message from other application in order to insert into the MQ queue.
So think the trigger method is not applicable to this situation.
Any suggestion if we wish to keep the connection alive without timeout? |
|
Back to top |
|
 |
PeterPotkay |
Posted: Thu Jan 31, 2008 8:35 am Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
Ask your MQ Administrator if he has the Queue Manager running with the ClientIdle parm coded in the Channel Stanza of the qm.ini file.
If not talk to your firewall people and ask how long will the firewall wait before it kills a connection that is not sending any traffic. _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
Vitor |
Posted: Thu Jan 31, 2008 8:37 am Post subject: Re: MQ Connection Timeout. |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
guccica wrote: |
However my application seems doesnt work like you say.
It will have thread awaiting messages, there will also have thread waiting message from other application in order to insert into the MQ queue.
So think the trigger method is not applicable to this situation. |
Really?
guccica wrote: |
Any suggestion if we wish to keep the connection alive without timeout? |
Ideally if you've got this kind of long running transaction you should run them binding on the server side. Failing that change the timeout parameters on the channel or recode your application to reconnect every time it detects the connection has failed unexpectedly. This is a good thing for a client application to do.
And be aware the connection not only uses resource but there is a finite (but configurable) number of connections the queue manager will allow. The Clients manual will explain all of this. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
guccica |
Posted: Thu Jan 31, 2008 6:21 pm Post subject: |
|
|
Novice
Joined: 18 Dec 2007 Posts: 17
|
Thanks for the advise everyone.
The more updated test result for my MQ client shows that it take quite a long time on the close() function.
080201 014630.456 Output Queue Close() called
080201 015230.649 Input Queue Close() called
080201 015230.653 Output Manager disconnect() called
080201 015230.653 Input Manager disconnect() called
from log above, it show that output queue use 6 minutes to close its connection.
The close function is called after the application idle for 1 hour. Then i trying to close all the connection and shutdown the application.
Have any ideal on this?
Is it cause by the timeout issue?
Thanks. |
|
Back to top |
|
 |
guccica |
Posted: Mon Feb 04, 2008 8:46 am Post subject: |
|
|
Novice
Joined: 18 Dec 2007 Posts: 17
|
guccica wrote: |
Thanks for the advise everyone.
The more updated test result for my MQ client shows that it take quite a long time on the close() function.
080201 014630.456 Output Queue Close() called
080201 015230.649 Input Queue Close() called
080201 015230.653 Output Manager disconnect() called
080201 015230.653 Input Manager disconnect() called
from log above, it show that output queue use 6 minutes to close its connection.
The close function is called after the application idle for 1 hour. Then i trying to close all the connection and shutdown the application.
Have any ideal on this?
Is it cause by the timeout issue?
Thanks. |
Hi...do anyone having the same issue with me before?
Please do advice.
I had try to set the close option to MQCO_DELETE, and it able to close normally after 1 hour.
However, the slowliness issue come out again after the connection open for 2 days.
Thanks. |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Feb 04, 2008 8:57 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Can we see the code that actually does the close? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
Vitor |
Posted: Mon Feb 04, 2008 8:57 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
guccica wrote: |
I had try to set the close option to MQCO_DELETE, and it able to close normally after 1 hour.
However, the slowliness issue come out again after the connection open for 2 days.
|
After 2 days, it had probably got bored / cached / paged out.
I still remain amazed that you need an application sitting on an open connection for 2 days, and can't use triggering.
But if you read my sig, you'll see I'm used to being amazed.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
guccica |
Posted: Mon Feb 04, 2008 9:30 am Post subject: |
|
|
Novice
Joined: 18 Dec 2007 Posts: 17
|
jefflowrey wrote: |
Can we see the code that actually does the close? |
I am using c++ for the MQ client developement.
below is the part of closing connection at my destructor function.
for(int i=0; i<100; i++)
{
pgMQObj[i].mpOutputQueue.setCloseOptions(MQCO_DELETE); //close option
pgMQObj[i].mpOutputQueue.close(); //close output queue
pgMQObj[i].mpInputQueue.setCloseOptions(MQCO_DELETE); //set close option
pgMQObj[i].mpInputQueue.close(); //close input queue
pgMQObj[i].mpOutputManager.disconnect();
pgMQObj[i].mpInputManager.disconnect();
}
Please advice..
Thanks a lot ya. |
|
Back to top |
|
 |
guccica |
Posted: Mon Feb 04, 2008 9:31 am Post subject: |
|
|
Novice
Joined: 18 Dec 2007 Posts: 17
|
Vitor wrote: |
guccica wrote: |
I had try to set the close option to MQCO_DELETE, and it able to close normally after 1 hour.
However, the slowliness issue come out again after the connection open for 2 days.
|
After 2 days, it had probably got bored / cached / paged out.
I still remain amazed that you need an application sitting on an open connection for 2 days, and can't use triggering.
But if you read my sig, you'll see I'm used to being amazed.  |
Hi victor, thanks for still answering my question.
I understand the point u stated and it do make sense.
However the MQ client edy design with this way. It would need a big changes if need to change.
So by any chances do there have any feature to support the connection which open all day long? |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Feb 04, 2008 9:34 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
It's fine to keep an MQ connection open all day.
MQ itself does it all the time.
MQ client applications, however, need to spend extra time keeping track of the connection status, leaving themselves in a Get-With-Wait, and retrying the connection if it breaks.
This doesn't really have much to do with why a close would take a long time. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
guccica |
Posted: Mon Feb 04, 2008 9:46 am Post subject: |
|
|
Novice
Joined: 18 Dec 2007 Posts: 17
|
jefflowrey wrote: |
It's fine to keep an MQ connection open all day.
MQ itself does it all the time.
MQ client applications, however, need to spend extra time keeping track of the connection status, leaving themselves in a Get-With-Wait, and retrying the connection if it breaks.
This doesn't really have much to do with why a close would take a long time. |
hi..
Thanks for the fast reply.
I do have a loop to eventually check if connection alive or not.
The code as follow::
//Set Get Message Option
gmo.setOptions( MQGMO_WAIT | /* wait for new messages */
MQGMO_FAIL_IF_QUIESCING ); /* but not is mqm stoppping */
/* time to wait to get MQ message */
gmo.setWaitInterval(500);
while(1)
{
//Get incoming message from MQ Queue
pgMQObj[i].mpInputQueue.get((ImqMsg&)imqMsg, gmo);
..
..
..
..
}
and i do have a mechanism to connect back to the MQ Server if the connection was drop.
I find that the connection able to close, but it do take a long time to close.
By any chances may i know what MQ is doing when it take 6 minutes to close 1 connection?
Thanks and hop[e to get reply soon. |
|
Back to top |
|
 |
|