ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ API Support » Message lost when interrupting application

Post new topic  Reply to topic
 Message lost when interrupting application « View previous topic :: View next topic » 
Author Message
rgarcia
PostPosted: Tue Nov 12, 2002 1:49 am    Post subject: Message lost when interrupting application Reply with quote

Newbie

Joined: 12 Nov 2002
Posts: 5

Hi, I'm pretty new to MQSeries programming and I've met with a serious problem:

I am doing a Java application under Linux that works with a Solaris MQSeries 5.1 Server. The problem is the following: if I am locked in a MQGet call and I Ctrl+C the application (thus abnormally finishing it), next time I run the application the first message on the queue gets lost.

This is happening always. Is there a programming technique or method to avoid this?

Thanks in advance
Back to top
View user's profile Send private message
mgrabinski
PostPosted: Tue Nov 12, 2002 3:40 am    Post subject: Reply with quote

Master

Joined: 16 Oct 2001
Posts: 246
Location: Katowice, Poland

The message did not get lost - it was consumed by your application. You can deal with this in two ways:
1) MQGET with MQGMO_BROWSE_NEXT option (message stays in queue after being read)
2) MQGET with MQGMO_SYNCPOINT option (getting a message within a transaction, the message will stay in the queue until you issue MQCMIT, if you abend your app, it will cause internal MQBACK resulting in the message being left in the queue)
_________________
Marcin Grabinski <><
Back to top
View user's profile Send private message
rgarcia
PostPosted: Tue Nov 12, 2002 3:58 am    Post subject: Reply with quote

Newbie

Joined: 12 Nov 2002
Posts: 5

Thanks, that really sounds interesting, but the fact is that when I Ctrl+C my app, the queue is empty, then I run the app and send a message to the queue. Is this first message that gets lost, as if nothing has happened. The second one works fine. Any more clue, please?
Back to top
View user's profile Send private message
nimconsult
PostPosted: Tue Nov 12, 2002 4:34 am    Post subject: Reply with quote

Master

Joined: 22 May 2002
Posts: 268
Location: NIMCONSULT - Belgium

If I understand well, your app is waiting on MQGET (with MQGMO_WAIT option) when you interrupt it. After you have interrupted the application, the first message you put on the queue gets lost.

If this is the description of your problem, then the reason is that the MQ Series agents linked to your application has not realized that your application is interrupted. When you put a first message on the queue, the agent retrieves the message, then fails in attempting to pass it back to the application and dies. When you put a second message on the queue, the agent is dead so the second message (and subsequent messages) remains on the queue.

How can you solve the issue? Implement your MQGET with MQGMO_SYNCPOINT. If you work under syncpoint, the agent will issue a rollback if it cannot pass the message to your application, so the message will go back into the queue.

I have already met this problem and I also find it frustrating. I don't like with this problem the side effect that the message sequence can be broken.

Nicolas
_________________
Nicolas Maréchal
Senior Architect - Partner

NIMCONSULT Software Architecture Services (Belgium)
http://www.nimconsult.be
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mgrabinski
PostPosted: Tue Nov 12, 2002 4:46 am    Post subject: Reply with quote

Master

Joined: 16 Oct 2001
Posts: 246
Location: Katowice, Poland

I'm not sure I get you correctly:
- you try to MQGET a message (with MQGMO_WAIT I assume)
- the queue is empty, so you abend your app
- you try to MQPUT two messages
- the first one gets lost

Is the expiry value set for the first mesasge? Are you puting with SYNCPOINT? Are you sure that nobody reads the queue in the meantime?

I know that those questions seem trival..

Can you post most crucial (from MQ point of view) parts of your code?I'd like to see put and get options especialy.
_________________
Marcin Grabinski <><
Back to top
View user's profile Send private message
rgarcia
PostPosted: Tue Nov 12, 2002 7:05 am    Post subject: Reply with quote

Newbie

Joined: 12 Nov 2002
Posts: 5

YES! By activating MQGMO_SYNCPOINT in the MQGet options the message gets not longer lost. Lots of thanks!!!
Back to top
View user's profile Send private message
PeterPotkay
PostPosted: Wed Nov 13, 2002 6:22 pm    Post subject: Reply with quote

Poobah

Joined: 15 May 2001
Posts: 7722

Marcin,
You have a Get with wait, and the queue is empty. If you abend your app, the app goes away, but the QM may not realize it right away. You can see this beacuse even though your app is gone, IPROCS count on the queue is still 1 for a while (undocumented by IBM as to how long. "About 10 seconds" is the best answer I got).

Now 2 messages land on the queue. As soon as the first message lands in the queue, the QM sees IPROC > 0, and sends the message to the "app". When it gets there, it says "Ooops, there is no one here! Should the message be rolled back? Well, there was no syncpoint associated with this last GET, so toss it. Oh, and fix that IPROCS count now." The second message does not get shipped to the phantom GET.

If the original GET was done with syncpoint, that 1st message would have been replaced back to the queue.

This is how it has been explained to me. I think I will test this whe I get a chance. For one thing, I am curious if the MQMD_BACKOUTCOUNT will go up by one on that 1st message when no syncpoint is used. And if I wait until IPROCS goes to 0, will the 1st message not get lost?
_________________
Peter Potkay
Keep Calm and MQ On
Back to top
View user's profile Send private message
nimconsult
PostPosted: Wed Nov 13, 2002 11:41 pm    Post subject: Reply with quote

Master

Joined: 22 May 2002
Posts: 268
Location: NIMCONSULT - Belgium

Hi Peter,

I have performed some of these experiences some times ago.

You are right, it's a question of a pending application agent running under MQ that does not realize that the application has gone away.

After the first message hits the queue, the agent gets it from the queue and dies in absence of the application. It's not really that MQ "fixes" the IPPROCS, but simply that the agent stops, which decreases the IPPROCS by 1.

If the original get was done within syncpoint, the first message goes back to the queue and the backout count gets increased by 1, as usual. After the first message, the agent is gone, so the second message will not disappear.

One side effect of this ghost application is that you can have a broken message sequence. Let me try to illustrate this:
- I start MYSERVER.EXE, which performs a get wait under syncpoint.
- For one reason or another, the application process gets killed.
- I restart the application MYSERVER.EXE
- I post MESSAGE1 and MESSAGE2 on the queue, in this sequence.
- MESSAGE1 is retrieved by the "ghost" agent
- MESSAGE2 is retrieved by MYSERVER.EXE
- the "ghost" agent puts MESSAGE1 back on the queue and dies
- MESSAGE1 is retrieved by MYSERVER.EXE
_________________
Nicolas Maréchal
Senior Architect - Partner

NIMCONSULT Software Architecture Services (Belgium)
http://www.nimconsult.be
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mgrabinski
PostPosted: Thu Nov 14, 2002 12:38 am    Post subject: Reply with quote

Master

Joined: 16 Oct 2001
Posts: 246
Location: Katowice, Poland

Peter, Nicholas - thanks for your thorough explanation. Althouth I've never seen that in my experience, but it's good to know.
_________________
Marcin Grabinski <><
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » Message lost when interrupting application
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.