Author |
Message
|
andy840920 |
Posted: Sun Apr 29, 2007 6:09 am Post subject: multi-process concurrent MQPUT but ended with ResonCode 2099 |
|
|
Apprentice
Joined: 29 Apr 2007 Posts: 44
|
my program like this:
Code: |
#include "test.h"
#include <unistd.h>
int main()
{
MYMQCONNX(&HandleA...); //use MQCNO_HANDLE_SHARE_BLOCK Option
MYMQOPEN(HandleA...); //use MQOO_INPUT_AS_Q_DEF option
MYMQCONNX(&HandleB...);//use MQCNO_HANDLE_SHARE_BLOCK Option
MYMQOPEN(HandleB); //use MQOO_OUTPUT option
while (1)
{
len = MYMQGET(HandleA...);
/*
gmo.Options=MQGMO_WAIT|MQGMO_LOGICAL_ORDER | MQGMO_ALL_MSGS_AVAILABLE | MQGMO_ALL_SEGMENTS_AVAILABLE */
if ((pid = fork()) != 0) {
if (pid < 0)
exit(-1);
else
continue;
}
//child process handle do some thing...
MYMQPUT(HandleB...);
/* no special option for MQPUT */
exit(0);
}
} |
when my process concurrency more then 30 then MQPUT return 2009 reson code. i don't know how to resolve the problem.thanks... |
|
Back to top |
|
 |
jefflowrey |
Posted: Sun Apr 29, 2007 8:38 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
I would say that you are running out of MaxActiveChannels on the queue manager.
I would also think that you need to control how many connections you want to open and close, likewise with the number of processes you want to fork. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
andy840920 |
Posted: Mon Apr 30, 2007 7:09 am Post subject: |
|
|
Apprentice
Joined: 29 Apr 2007 Posts: 44
|
jefflowrey wrote: |
I would say that you are running out of MaxActiveChannels on the queue manager.
I would also think that you need to control how many connections you want to open and close, likewise with the number of processes you want to fork. |
how to know the MaxActiveChannels value? and my fork process must close and disconnect the connection? i think when my sub process exit and the connection disconnected... |
|
Back to top |
|
 |
marcin.kasinski |
Posted: Mon Apr 30, 2007 7:21 am Post subject: |
|
|
Sentinel
Joined: 21 Dec 2004 Posts: 850 Location: Poland / Warsaw
|
You can find MaxActiveChannels value in qm.ini CHANNELS stanza
Quote: |
MAXCHANNELS=n ; Maximum number of channels allowed, the ; default value is 100
MAXACTIVECHANNELS=n ; Maximum number of channels allowed to be active at ; any time, the default is the value of MaxChannels
|
_________________ Marcin |
|
Back to top |
|
 |
marcin.kasinski |
Posted: Mon Apr 30, 2007 7:27 am Post subject: |
|
|
Sentinel
Joined: 21 Dec 2004 Posts: 850 Location: Poland / Warsaw
|
|
Back to top |
|
 |
andy840920 |
Posted: Mon Apr 30, 2007 7:48 am Post subject: |
|
|
Apprentice
Joined: 29 Apr 2007 Posts: 44
|
marcin.kasinski wrote: |
MaxActiveChannels value you can find in qm.ini CHANNELS stanza
Quote: |
MAXCHANNELS=n ; Maximum number of channels allowed, the ; default value is 100
MAXACTIVECHANNELS=n ; Maximum number of channels allowed to be active at ; any time, the default is the value of MaxChannels |
|
but my application is not use channels. only direct connect queue of the MQManage |
|
Back to top |
|
 |
Vitor |
Posted: Mon Apr 30, 2007 7:57 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
andy840920 wrote: |
but my application is not use channels. only direct connect queue of the MQManage |
If you're getting a 2009 (Connection Broken) then you're using the client channels to connect. If your application is not running on the same machine as the queue manager, that's the only way it can connect to the queue manager.
If you want to connect directly to the queue manger then you need to relink with the server libs not the client ones, and ensure your application is running on the queue manager machine. It'll fail with a 2058 running anywhere else. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
andy840920 |
Posted: Mon Apr 30, 2007 7:58 am Post subject: |
|
|
Apprentice
Joined: 29 Apr 2007 Posts: 44
|
my problem is why some concurrency processes put msg to the queue at the same time would return ResonCode 2009 by MQPUT operate. these concurrency processes are forked by the same parent process and shared the handle produced by the parent process. but when i re-connect , re-open MQPUT close and disconnect to the queue in every child process still return the same result. |
|
Back to top |
|
 |
Vitor |
Posted: Mon Apr 30, 2007 8:02 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
andy840920 wrote: |
my problem is why some concurrency processes put msg to the queue at the same time would return ResonCode 2009 by MQPUT operate. |
Other than the explainations given above...?
If you can't recode as suggested, you may need to move the code server side. _________________ Honesty is the best policy.
Insanity is the best defence.
Last edited by Vitor on Mon Apr 30, 2007 8:03 am; edited 1 time in total |
|
Back to top |
|
 |
andy840920 |
Posted: Mon Apr 30, 2007 8:03 am Post subject: |
|
|
Apprentice
Joined: 29 Apr 2007 Posts: 44
|
Vitor wrote: |
andy840920 wrote: |
but my application is not use channels. only direct connect queue of the MQManage |
If you're getting a 2009 (Connection Broken) then you're using the client channels to connect. If your application is not running on the same machine as the queue manager, that's the only way it can connect to the queue manager.
If you want to connect directly to the queue manger then you need to relink with the server libs not the client ones, and ensure your application is running on the queue manager machine. It'll fail with a 2058 running anywhere else. |
my application is running on the same machine with the MQ server. my app MQGET from the other machine via remote channel, and MQPUT to the local queue directly. but it not failed with 2058 and that 2099 , why ? |
|
Back to top |
|
 |
Vitor |
Posted: Mon Apr 30, 2007 8:07 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
andy840920 wrote: |
my application is running on the same machine with the MQ server. my app MQGET from the other machine via remote channel, and MQPUT to the local queue directly. but it not failed with 2058 and that 2099 , why ? |
Your application may be running on the same machine as the queue manager, but that 2009 indicates it's linked with the client libraries and is using the client connection.
It's also not doing an MQGET from a remote anything - MQGET is only valid on a queue local to the connection. If the reading queue is on another machine, you must have a client connection to that queue manager or it wouldn't be working.
Think about the queue architecture, where your application fits logically and how the messages flow. This will help you resolve this problem. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
andy840920 |
Posted: Mon Apr 30, 2007 8:24 am Post subject: |
|
|
Apprentice
Joined: 29 Apr 2007 Posts: 44
|
Vitor wrote: |
andy840920 wrote: |
my problem is why some concurrency processes put msg to the queue at the same time would return ResonCode 2009 by MQPUT operate. |
Other than the explainations given above...?
If you can't recode as suggested, you may need to move the code server side. |
my code is running on server side...but why still appeared the problem |
|
Back to top |
|
 |
andy840920 |
Posted: Mon Apr 30, 2007 8:27 am Post subject: |
|
|
Apprentice
Joined: 29 Apr 2007 Posts: 44
|
Vitor wrote: |
andy840920 wrote: |
my application is running on the same machine with the MQ server. my app MQGET from the other machine via remote channel, and MQPUT to the local queue directly. but it not failed with 2058 and that 2099 , why ? |
Your application may be running on the same machine as the queue manager, but that 2009 indicates it's linked with the client libraries and is using the client connection.
It's also not doing an MQGET from a remote anything - MQGET is only valid on a queue local to the connection. If the reading queue is on another machine, you must have a client connection to that queue manager or it wouldn't be working.
Think about the queue architecture, where your application fits logically and how the messages flow. This will help you resolve this problem. |
my app is running on the same machine as the queue manager, but MQGET from a queue local and the queue is the remote queue created by an other queue manager on other machine. MQPUT to a queue local created by the QM on the same machine with MQ Server and my app. |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Apr 30, 2007 9:26 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
if you have a 2099
2099 0x00000833 MQRC_SIGNAL1_ERROR
you probably have some other errors and at least an FDC.
My guess is that this is some concurrency problem and sharing handle problem.
Each thread should use it's own handle...
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Apr 30, 2007 11:22 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Also, please note that a 2099 is completely different than a 2009. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|