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 » Urgent: multi-thread issue with MQ client (C#)

Post new topic  Reply to topic
 Urgent: multi-thread issue with MQ client (C#) « View previous topic :: View next topic » 
Author Message
UncleAndy
PostPosted: Thu Sep 15, 2005 3:28 am    Post subject: Urgent: multi-thread issue with MQ client (C#) Reply with quote

Newbie

Joined: 15 Sep 2005
Posts: 7

Hi,

I am experiencing problems when running multiple threads against my MQ Server. WebSphere MQ v.5.3 (with CSD 10) is installed on a Windows 2000 Server (with decent hardware) and my client is located on a separate box (also Windows 2000 Server). The client is written in C# and communicates over TCP. Each thread creates a new instance of the queue manager, MQ environment and sender/receiver channels. A dummy server is set up to get messages from one queue and place a response on another which is retrieved from the client.

When the traffic load is "high" (10 simultanious threads..) everything works fine until a certain point when things seem to get clogged up. The 10 threads are started simultaniously and perform 1 request each. When all 10 threads have completed, 10 new threads are spawned and does that same operation. The QM object is created successfully, but when I invoke methods (qMgr.Get(), gMgr.MaximumHandles() etc) I get a null pointer exception and it seems like the QM object has lost connection with the server. The server does not recover from this, and I experience more and more threads throwing exceptions until I shut down MQ and restart it to get a fresh start.

I also experience exceptions identified as MQRC_HOBJ_ERROR, which indicates that an object handle is invalid. The corrective action for this is:

Quote:
Ensure that a successful MQOPEN call is performed for this object


Do I have to put in a check for each time I use the QM object to see if it's still "open"? If so, how can this done?

Single thread works fine, and as mentioned above multiple threads also work fine until a certain point.

This is critical to us right now, and I need to sort this out ASAP. I would appreciate any help!

Thanks!

Andreas
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Sep 15, 2005 8:24 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

I'd say you're probably running out of available client connections on the qmgr.

This is a really bad design for your app - you'd never code a database app the same way, I hope.

I would change your code to establish the qmgr connection as a thread-shareable connection, and use exactly one connection for each qmgr you need, and only close it when your program ends or when an error indicates that the qmgr is down.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
UncleAndy
PostPosted: Thu Sep 15, 2005 11:16 pm    Post subject: Reply with quote

Newbie

Joined: 15 Sep 2005
Posts: 7

Thank you for you input! The reason why I created a new instance of the QM for each request was that it was actually suggested in one of the IBM eBooks.. (please shoot me if I misunderstood that! ). I am currently changing the client now to only keep one connection to the QM open at the time.

Let's hope this will solve my issue!

Andreas
Back to top
View user's profile Send private message
UncleAndy
PostPosted: Tue Sep 20, 2005 12:39 am    Post subject: Reply with quote

Newbie

Joined: 15 Sep 2005
Posts: 7

I still have problems when traffic is high. What happens is that I get a null pointer exception when I try to access the queues (either through QueueManager.AccessQueues or QueueManager.Get/Put).

Does anyone know the cause of this? Is the MQ Server dropping connections because the number is too high? I have tried to increase the values for:

MaxChannels (1024)
MaxActiveChannels (1024)
MaxInitiators (32)
ListenerBackLog (512)
EntryPoints (100)

- all config settings for the QM available through the MQ Services console.

Any other settings I should look at?

Andreas
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Sep 20, 2005 3:35 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

I guess you should confirm that you're not trying to access a null pointer...

If it were an issue with MQ dropping connections, you should get a reason code back that told you something, and there would be error messages in the queue manager system log.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
JasonE
PostPosted: Tue Sep 20, 2005 3:40 am    Post subject: Reply with quote

Grand Master

Joined: 03 Nov 2003
Posts: 1220
Location: Hursley

Whats the call stack from the null pointer? Your code, or MQ's?

What version/release of mq? If 5.3, try applying fixpack 10 or 11, registering the amqmdnet.dll into the GAC and seeing if the problem continues

Can you cut the code down to a trivial sample, and post here?
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 » Urgent: multi-thread issue with MQ client (C#)
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.