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 » MQ Program Stucked forever

Post new topic  Reply to topic Goto page 1, 2  Next
 MQ Program Stucked forever « View previous topic :: View next topic » 
Author Message
michael.shapira
PostPosted: Tue Apr 17, 2007 10:58 pm    Post subject: MQ Program Stucked forever Reply with quote

Novice

Joined: 03 Apr 2007
Posts: 14

Hi . I am browsing the queue using the following code
Code:
manager = new MQQueueManager(queueManager);
         int openOption = MQC.MQOO_BROWSE | MQC.MQOO_INPUT_SHARED ; // open options for browse & share

         q = manager.accessQueue(queueName, openOption,null,null,null);
         //System.out.println( "Open queue sucessfull... ");

         MQGetMessageOptions getMessageOptions = new MQGetMessageOptions();
         getMessageOptions.options = MQC.MQGMO_BROWSE_FIRST| MQC.MQGMO_WAIT ; //for browsing
         getMessageOptions.waitInterval = MQC.MQWI_UNLIMITED; // for waiting unlimted times

         // waits unlimited
         while(true)
         {
            MQMessage message = new MQMessage();
            
            String strMsg;
            try
            {
               //System.out.println( "waiting for message ... ");
               q.get(message, getMessageOptions);
//Do job here
}
catch(Exception e){e.getMessage();}


when the program gets to the
Code:
q.get(message, getMessageOptions);
it stucked forever without throwing nothing. I also see the the channel is running and I am the only remote connection to that channel. What can be the problem??
Back to top
View user's profile Send private message
michael.shapira
PostPosted: Tue Apr 17, 2007 11:56 pm    Post subject: Reply with quote

Novice

Joined: 03 Apr 2007
Posts: 14

I checked the following. Is my objects have the same name as in the server-yes, case sensitive-yes.
I checked the listener port it was 1415, but in my program it was 1414. So after I changed it to 1415 I started to get the following message:

ERROR: MQJE001: An MQException occurred: Completion Code 2, Reason 2009
MQJE016: MQ queue manager closed channel immediately during connect
Closure reason = 2009

What can be the reason???
Back to top
View user's profile Send private message
marcin.kasinski
PostPosted: Tue Apr 17, 2007 11:59 pm    Post subject: Reply with quote

Sentinel

Joined: 21 Dec 2004
Posts: 850
Location: Poland / Warsaw

Have you red QMGR logs ?
_________________
Marcin
Back to top
View user's profile Send private message Visit poster's website
michael.shapira
PostPosted: Wed Apr 18, 2007 12:05 am    Post subject: Reply with quote

Novice

Joined: 03 Apr 2007
Posts: 14

I the log I only found the following from today

04/18/2007 10:43:06
AMQ7880: Error code 0 starting QM.PTVWDI/Listener WebSphere MQ service.

EXPLANATION:
The service was unable to start QM.PTVWDI/Listener. The error message reported
was as follows: The process has terminated with return code 20.
ACTION:
Use WebSphere MQ Services to investigate why the service could not begin. If
recovery for this service is active, MQ will attempt to recover.
-------------------------------------------------------------------------------
04/18/2007 10:43:16
AMQ7880: Error code 0 starting QM.PTVWDI/Listener WebSphere MQ service.

EXPLANATION:
The service was unable to start QM.PTVWDI/Listener. The error message reported
was as follows: The process has terminated with return code 20.
ACTION:
Use WebSphere MQ Services to investigate why the service could not begin. If
recovery for this service is active, MQ will attempt to recover.
-------------------------------------------------------------------------------
04/18/2007 10:43:41
AMQ7880: Error code 0 starting QM.PTVWDI/Listener WebSphere MQ service.

EXPLANATION:
The service was unable to start QM.PTVWDI/Listener. The error message reported
was as follows: The process has terminated with return code 20.
ACTION:
Use WebSphere MQ Services to investigate why the service could not begin. If
recovery for this service is active, MQ will attempt to recover.

it is my attempt to play with the Listener
Back to top
View user's profile Send private message
marcin.kasinski
PostPosted: Wed Apr 18, 2007 12:12 am    Post subject: Reply with quote

Sentinel

Joined: 21 Dec 2004
Posts: 850
Location: Poland / Warsaw

Check if other process (QM ?) listen on 1415 port.

Code:
telnet yourhost 1415

_________________
Marcin
Back to top
View user's profile Send private message Visit poster's website
michael.shapira
PostPosted: Wed Apr 18, 2007 12:20 am    Post subject: Reply with quote

Novice

Joined: 03 Apr 2007
Posts: 14

telnet was successfully. I also noticed that the problem exists for browsing only. I also have a peace of code that checking "trigger control" with the same values for the host, qmanager,queue, channel and port, that works perfectly!!! I am really confused
Back to top
View user's profile Send private message
michael.shapira
PostPosted: Wed Apr 18, 2007 12:24 am    Post subject: Reply with quote

Novice

Joined: 03 Apr 2007
Posts: 14

My queue is empty now. Can it influence the browsing?
Back to top
View user's profile Send private message
marcin.kasinski
PostPosted: Wed Apr 18, 2007 12:35 am    Post subject: Reply with quote

Sentinel

Joined: 21 Dec 2004
Posts: 850
Location: Poland / Warsaw

Wait , wait, wait,

Maybe I don't understand something.

What is the problem now.
First it was application hungs, Then it was error 2009.

Describe your current problem.

PS. When you set WAIT_UNLIMITED and there is no message in queue get method will block your application until queue is empty.
_________________
Marcin
Back to top
View user's profile Send private message Visit poster's website
zpat
PostPosted: Wed Apr 18, 2007 3:54 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

No, until a message arrives that meets your selection criteria.
Back to top
View user's profile Send private message
marcin.kasinski
PostPosted: Wed Apr 18, 2007 4:13 am    Post subject: Reply with quote

Sentinel

Joined: 21 Dec 2004
Posts: 850
Location: Poland / Warsaw

zpat wrote:
No, until a message arrives that meets your selection criteria.



Of course.

I agree.

I tried to say it as simple as possible
_________________
Marcin
Back to top
View user's profile Send private message Visit poster's website
Vitor
PostPosted: Wed Apr 18, 2007 4:22 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

marcin.kasinski wrote:
zpat wrote:
No, until a message arrives that meets your selection criteria.



Of course.

I agree.

I tried to say it as simple as possible


marcin.kasinski wrote:

there is no message in queue get method will block your application until queue is empty.


What you said was simple, but backwards. It will block until a message arrives (that meets the criteria) not until the queue is empty again...
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
marcin.kasinski
PostPosted: Wed Apr 18, 2007 4:46 am    Post subject: Reply with quote

Sentinel

Joined: 21 Dec 2004
Posts: 850
Location: Poland / Warsaw

Vitor wrote:

What you said was simple, but backwards. It will block until a message arrives (that meets the criteria) not until the queue is empty again...



But for example listed here it was true. There was no additional criteria.

OK. I will try to speak more carefully.
_________________
Marcin
Back to top
View user's profile Send private message Visit poster's website
michael.shapira
PostPosted: Wed Apr 18, 2007 5:14 am    Post subject: Reply with quote

Novice

Joined: 03 Apr 2007
Posts: 14

Thank you all.

PS. When you set WAIT_UNLIMITED and there is no message in queue get method will block your application until queue is empty.

is the solution I was looking for
Back to top
View user's profile Send private message
marcin.kasinski
PostPosted: Wed Apr 18, 2007 5:23 am    Post subject: Reply with quote

Sentinel

Joined: 21 Dec 2004
Posts: 850
Location: Poland / Warsaw

From docs...

Quote:
Receiving a message from WebSphere MQ

There are several ways of receiving a message from WebSphere MQ:

* Polling by issuing a GET followed by a Wait, using the Visual Basic TIMER function.
* Issuing a GET with the Wait option; you specify the wait duration by setting the WaitInterval property. This is recommended when, even though you set your system up to run in multithreaded environment, the software running at the time may run only singlethreaded. This avoids your system locking up indefinitely.

Other threads operate unaffected. However, if your other threads require access to WebSphere MQ, they require a second connection to WebSphere MQ using additional MQAX queue manager and queue objects.

Issuing a GET with the Wait option and setting the WaitInterval to MQWI_UNLIMITED causes your system to lock up until the GET call completes, if the process is singlethreaded.

_________________
Marcin
Back to top
View user's profile Send private message Visit poster's website
jefflowrey
PostPosted: Wed Apr 18, 2007 5:53 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

When you set WAIT_UNLIMITED, your program will block until a message that satisfies the Get Options arrives.

It has nothing to do with whether the queue is empty or full.

If you set WAIT_UNLIMITED, and you match against a MsgId, and there is no way that a message with that MsgId will ever arrive on the queue, then your GET will never complete. The queue could be full, it could be empty, messages could come into the queue and leave again, and your GET will still be WAITing.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » IBM MQ API Support » MQ Program Stucked forever
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.