Author |
Message
|
lyntongrice |
Posted: Mon Nov 14, 2011 1:20 am Post subject: How to prevent MQGMO_WAIT from cancelling during MQGET? |
|
|
Acolyte
Joined: 26 Sep 2010 Posts: 70
|
Hi there,
I am issuing an MQGET and would like to know under what circumstances the MQGET WAIT interval will cancel?
At the following URL it says:
http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/index.jsp?topic=%2Fcom.ibm.mq.csqsao.doc%2Ffm12160_1.htm
"If the call is an MQGET call with the MQGMO_WAIT option, the wait has been canceled. All connection and object handles are now invalid."
So what would cause the wait step to terminate? Just a network issue? But I am running the application on the same box as MQ? I do push CTRL-C in the main application....so perhaps that interrups the current wait.....
I am just curious is there are any other options that would elegantly just make the MQGET fail? Reason I ask is that this wait step is getting cancelled and it is producing FDC's on the server that the MQ admin is not happy about....
BTW: This post is related to my other post http://www.mqseries.net/phpBB2/viewtopic.php?p=317402#317402
but is asking something a little different....
Thanks for the help
Lynton |
|
Back to top |
|
 |
zpat |
Posted: Mon Nov 14, 2011 1:26 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
MQGMO_FAIL_IF_QUIESCING is one way to allow it to terminate, if the QM is being ended normally. Ending QM with -i will terminate it anyway.
If you terminate the process/thread that has issued the MQGET, then I am not surprised MQ is unhappy about it. It can hardly override the operating system. |
|
Back to top |
|
 |
lyntongrice |
Posted: Mon Nov 14, 2011 2:20 am Post subject: |
|
|
Acolyte
Joined: 26 Sep 2010 Posts: 70
|
Hi there, thanks for the response.....and yes, I agree...having a SIGNAL go to a thread in the background could very well upset the MQGET call that is busy in a WAIT step....
That is why I am using SIG_BLOCK etc now to hopefully get around it.....
Chat later
Lynton |
|
Back to top |
|
 |
mvic |
Posted: Mon Nov 14, 2011 3:18 am Post subject: |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
lyntongrice wrote: |
That is why I am using SIG_BLOCK etc now to hopefully get around it..... |
I don't understand how that would help. |
|
Back to top |
|
 |
lyntongrice |
Posted: Mon Nov 14, 2011 3:31 am Post subject: |
|
|
Acolyte
Joined: 26 Sep 2010 Posts: 70
|
Well if I have the MQGET thread running seperatly from the MAIN C thread and I tell that MQGET thread to ignore all signals I do think it would help....
My initial issue was when I hit CTRL-C and the main thread handles the shutdown hook to elegantly shutdown the MQGET thread etc, I am getting an MQRC_CONNECTION_BROKEN (2009) on the MQGET call that is currently running.....and that tells me "something happened when CTRL-C was hit" ......that is why I want to prevent any signals at all going to the "spawned thread"....
The queue manager is not stopping here....the CTRL-C (SIGINT) is causing something on the wait step on the MQGET to be interrupted......but interesting is on Linux and Solaris I have no issue......only on AIX......
Chat later  |
|
Back to top |
|
 |
mvic |
Posted: Mon Nov 14, 2011 3:46 am Post subject: |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
|
Back to top |
|
 |
mvic |
Posted: Mon Nov 14, 2011 3:48 am Post subject: Re: How to prevent MQGMO_WAIT from cancelling during MQGET? |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
lyntongrice wrote: |
Reason I ask is that this wait step is getting cancelled and it is producing FDC's on the server that the MQ admin is not happy about. |
What is the header and MQM Function stack of the FDC? |
|
Back to top |
|
 |
lyntongrice |
Posted: Mon Nov 14, 2011 4:41 am Post subject: GET |
|
|
Acolyte
Joined: 26 Sep 2010 Posts: 70
|
Hi there,
Those signals and MQ calls are VERY handy....thanks a million!!
The FDC's etc are on another similar thread on this forum from me:
http://www.mqseries.net/phpBB2/viewtopic.php?p=317402#317402
I am now even more confused as to why my MQGET raises 2009 (MQRC_CONNECTION_BROKEN) on AIX when I issue CTRL-C on the main application.....MQ seems to handle signals fine......mmmmm |
|
Back to top |
|
 |
bruce2359 |
Posted: Mon Nov 14, 2011 5:53 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9470 Location: US: west coast, almost. Otherwise, enroute.
|
I'll ask the obvious questions:
Why do you issue a CTRL+C in the main application?
What did you think (expect, believe) would happen when you issue a CTRL+C in the main application? _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Nov 14, 2011 11:14 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Seems to me you have a design issue and a "runaway" application.
Let's say you have a foreground process that is starting a multithreaded background application, the question then is how do you control the background application?
Well the answer is somewhere else... You need to have a "server" app built that opens a port. Requests will be made to that port to retrieve a controller object. The requests on the controller object should then allow you to manipulate the background app. Note that the controller will need to keep a reference to the background app. So to start the background app you will need to start the controller and bootstrap it to the server....
In java you would have a name server and RMI calls...
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
bruce2359 |
Posted: Mon Nov 14, 2011 12:02 pm Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9470 Location: US: west coast, almost. Otherwise, enroute.
|
Seems like this is a fundamental process-management design flaw.
Since the OP didn't offer much detail, I'm guessing that the main app MQCONNects to the qmgr, and then launches a child thread that does an MQGET.
The CTRL+C kills the parent process, leaving the child MQGET parent-less. The MQGET is not killed with a SIG. Rather, the orphaned MQGET call will be failed with r/c2009 because the parent with the connection handle no longer exists. _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
mvic |
Posted: Tue Nov 15, 2011 2:21 pm Post subject: Re: GET |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
lyntongrice wrote: |
Those signals and MQ calls are VERY handy....thanks a million!! |
You are very welcome.
Thank you. I have just added a comment in that other thread. |
|
Back to top |
|
 |
rekarm01 |
Posted: Wed Nov 16, 2011 3:43 am Post subject: Re: How to prevent MQGMO_WAIT from cancelling during MQGET? |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
lyntongrice wrote: |
http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/index.jsp?topic=%2Fcom.ibm.mq.csqsao.doc%2Ffm12160_1.htm
"If the call is an MQGET call with the MQGMO_WAIT option, the wait has been canceled. All connection and object handles are now invalid."
So what would cause the wait step to terminate? |
There was a sentence or two before that:
Quote: |
Connection to the queue manager has been lost. ... If the call is an MQGET call with the MQGMO_WAIT option, the wait has been canceled. |
The connection to the queue manager has been lost. That would cause the wait step to terminate.
The application needs to execute the following steps in order:- wait for the MQGET to complete
- close the queue
- disconnect from the qmgr
If the main thread disconnects from the queue manager while the MQGET is still in progress, that would cause the MQGET to abend with a MQRC_CONNECTION_BROKEN error.
lyntongrice wrote: |
I am using SIG_BLOCK etc now to hopefully get around it ... I tell that MQGET thread to ignore all signals ... |
Block is not the same as ignore.
lyntongrice wrote: |
My initial issue was when I hit CTRL-C and the main thread handles the shutdown hook to elegantly shutdown the MQGET thread |
Which thread handles the close and disconnect? Is that before or after the MQGET completes? |
|
Back to top |
|
 |
mvic |
Posted: Wed Nov 16, 2011 3:51 am Post subject: Re: How to prevent MQGMO_WAIT from cancelling during MQGET? |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
rekarm01 wrote: |
Which thread handles the close and disconnect? |
The OP's other forum thread shows that the app was linked with libmqm when it should (because it uses threads) be using libmqm_r. IMHO all bets are off until that program is rebuilt correctly. |
|
Back to top |
|
 |
|