Author |
Message
|
KirTakat |
Posted: Wed Sep 14, 2005 9:20 am Post subject: C# and error code 2017 |
|
|
Newbie
Joined: 22 Jul 2005 Posts: 6
|
I'm having an issue with IBM MQ throwing an exception after my program has been running for a while. After the application has been up for a (variable) period of time, it will start to throw a 2017 error (MQRC_HANDLE_NOT_AVAILABLE, basically the maximum number of open handles has been reached). There are other threads running at the same time, but they connect to different queues.
The relevant thread of the application basically works like this:
queueManager.Connect
while(running)
{
queue.Open
while(there are still messages on queue)
{
queue.get <-- Error occurs here
}
queue.Close
}
queueManager.disconnect |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Sep 14, 2005 9:27 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Are all the threads connecting to the same qmgr, or different qmgrs? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
wschutz |
Posted: Wed Sep 14, 2005 9:35 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
Are you sure thats being thrown from the get? It seems more likely that you'd get that from the open method.
You could always increase maxhandles on the queue manager....
EDIT: and also... why do you open and close the queue when you get "no more messages"? Why not just redrive the GET again? Based on what you posted, it looks like you in a tight loop of "open -> get (2033) -> close" when the queue is empty .....
EDIT2: (I don't know c#) but are you SURE that close method is getting executed when you handle the 2033 condition? _________________ -wayne
Last edited by wschutz on Wed Sep 14, 2005 9:44 am; edited 2 times in total |
|
Back to top |
|
 |
KirTakat |
Posted: Wed Sep 14, 2005 9:41 am Post subject: |
|
|
Newbie
Joined: 22 Jul 2005 Posts: 6
|
The threads are all connecting to the same queue manager, but the error always occurs in the same thread.
As for the queue.Open, no, it definately seems to be occuring during the queue.get.
Last edited by KirTakat on Wed Sep 14, 2005 9:45 am; edited 1 time in total |
|
Back to top |
|
 |
KirTakat |
Posted: Wed Sep 14, 2005 9:45 am Post subject: |
|
|
Newbie
Joined: 22 Jul 2005 Posts: 6
|
Quote: |
why do you open and close the queue when you get "no more messages"? |
Because this application runs 24/7 for days on end, but it's sleeping for 20 hours in a given day. And because the queue it's connecting to can be (never has been, but the functionality was requested) changed on the fly.
Edit: I know the close method is being called after I get the 2033.
Last edited by KirTakat on Wed Sep 14, 2005 9:49 am; edited 1 time in total |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Sep 14, 2005 9:45 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
If all of the threads are connecting to the same qmgr, you're a lot better off opening it as a thread-shareable connection once, and using it in every thread, rather than opening a thread local connection in each thread.
If there aren't any guarantees in your design that it will be the same qmgr, then a simple connection pool will do a nice trick. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|