Author |
Message
|
standapi |
Posted: Sun Nov 04, 2012 11:30 am Post subject: Channel auto-definition exit and memory management |
|
|
Newbie
Joined: 04 Nov 2012 Posts: 7
|
Hi All
We are trying to do "channel auto-definition exit" = CHADEX. We have MQCluster. We want to set some message exit only on one specific cluster sender channel (from QMA to QMB). If message exit is set on CLUSRCVR channel QMB queue manager, than definition is propagated to all auto-CLUSSDR channels defined based on this CLUSRCVR, we don't want it.
WMQ in tests is 7.0.1.9.
Wy tryied it on linux 64bit and Solaris sparc, zOS.
When we try to set some channel parameter, for example MQCD->MaxMsgLength, the setting works (in the CHADEX we set 1byte, so we get expected errors in MQ error log regarding auto defined channel). But we are unable to find instructions on how to allocate/free memory for MQCD->MsgExitPtr and MQCD->MsgUserDataPtr and at what phase (MQXR_INIT/MQXR_AUTO_CLUSSDR/MQXR_TERM).
For security exit there is nice docs - "link1" with detailed workflow. But for CHADEX there is no such information available. The best we found is "link2".
We did many various tests but what we got is FDC with comment - SIGSEGV: address not mapped((nil)) even though for example we are allocating memory for MQCD->MsgExitPtr/MsgUserDataPtr in each phase - INIT/AUTO_CLUSSDR/TERM.
Documentation for WMQ75 is not better in this regard.
How should be memory managed for fields MsgExitPtr/MsgUserDataPtr?
Sorry, first post so I can't post links.
link1: infocenter for WMQ7.0.1 - WebSphere MQ - Intercommunication - Further intercommunication considerations - Channel-exit programs - What are channel-exit programs? - Channel security exit programs
link2: infocenter for WMQ7.0.1 - WebSphere MQ - Intercommunication - Further intercommunication considerations - Channel-exit programs - What are channel-exit programs? - Channel auto-definition exit program
In code we use:
pCD->MsgExitPtr = (void*)malloc(pCD->ExitNameLength);
pCD->MsgUserDataPtr = (void*)malloc(pCD->ExitDataLength);
/* now copy some values into pCD->MsgExitPtr and pCD->MsgUserDataPtr */
Sample FDC we got:
+-----------------------------------------------------------------------------+
| |
| WebSphere MQ First Failure Symptom Report |
| ========================================= |
| |
| Date/Time :- Wed October 31 2012 16:40:04 UTC |
| UTC Time :- 1351701604.324734 |
| UTC Time Offset :- 60 (CET) |
| Host Name :- localhost.localdomain |
| Operating System :- Linux 2.6.32-279.el6.x86_64 |
| PIDS :- 5724H7230 |
| LVLS :- 7.0.1.9 |
| Product Long Name :- WebSphere MQ for Linux (x86-64 platform) |
| Vendor :- IBM |
| Probe Id :- XC130003 |
| Application Name :- MQM |
| Component :- xehExceptionHandler |
| SCCS Info :- lib/cs/unix/amqxerrx.c, 1.242.1.3 |
| Line Number :- 1401 |
| Build Date :- Jul 18 2012 |
| CMVC level :- p701-109-120718 |
| Build Type :- IKAP - (Production) |
| Effective UserID :- 501 (mqm) |
| Real UserID :- 501 (mqm) |
| Program Name :- amqrmppa |
| Addressing mode :- 64-bit |
| Process :- 5418 |
| Process(Thread) :- 5422 |
| Thread :- 6 |
| ThreadingModel :- PosixThreads |
| QueueManager :- WMBL2T10 |
| UserApp :- FALSE |
| ConnId(1) IPCC :- 177 |
| Last HQC :- 1.0.0-1566848 |
| Last HSHMEMB :- 0.0.0-0 |
| Major Errorcode :- STOP |
| Minor Errorcode :- OK |
| Probe Type :- HALT6109 |
| Probe Severity :- 1 |
| Probe Description :- AMQ6109: An internal WebSphere MQ error has occurred. |
| FDCSequenceNumber :- 0 |
| Arith1 :- 11 (0xb) |
| Comment1 :- SIGSEGV: address not mapped((nil)) |
| |
+-----------------------------------------------------------------------------+ |
|
Back to top |
|
 |
mqjeff |
Posted: Sun Nov 04, 2012 1:36 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
It's confusing that you want to block only a single pathway in a cluster with an exit.
The only scenarios I can think of where that might be necessary are when you are trying to span an MQ cluster across a hard network or business level boundary - between two data centers or between two business partners for example.
And that kind of scenario, for a large number of reasons, is significantly better handled by using a gateway pattern rather than a cluster exit.
Otherwise, I do not believe that the rules for how to allocated data structures change for different types of exits. |
|
Back to top |
|
 |
Mr Butcher |
Posted: Mon Nov 05, 2012 1:14 am Post subject: |
|
|
 Padawan
Joined: 23 May 2005 Posts: 1716
|
i too had to use something similiar to get rid of exits on implicit build cluster sender channels. use this as a sample on your own risk
Code: |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <cmqc.h>
#include <cmqxc.h>
/* get rid of exit "EXITNAME" on implicit build cluster sender channel */
MQCHANNELAUTODEFEXIT CADEXITP;
void MQStart() {;}
void MQENTRY CADEXITP ( PMQVOID pChannelExitParms,
PMQVOID pChannelDefinition)
{
PMQCXP pCEP = pChannelExitParms;
PMQCD pCD = pChannelDefinition;
// assume we do not allow the channel autodefinition
pCEP->ExitResponse = MQXCC_SUPPRESS_FUNCTION;
if (pCEP->ExitReason==MQXR_INIT)
{
pCEP->ExitResponse = MQXCC_OK;
}
else
{
if (pCEP->ExitReason==MQXR_TERM)
{
pCEP->ExitResponse = MQXCC_OK;
}
else
{
if (pCEP->ExitReason==MQXR_AUTO_CLUSSDR)
{
pCEP->ExitResponse = MQXCC_OK;
if (pCD->MsgExitPtr!=NULL)
{
if (strncmp(pCD->MsgExitPtr,"EXITNAME",8) == 0)
{
strncpy(pCD->MsgExitPtr," ",8) ;
}
}
}
if (pCEP->ExitReason==MQXR_AUTO_CLUSRCVR)
{
pCEP->ExitResponse = MQXCC_OK;
}
}
}
} |
[/code] _________________ Regards, Butcher |
|
Back to top |
|
 |
standapi |
Posted: Tue Nov 06, 2012 3:53 am Post subject: Who is responsible for memory? |
|
|
Newbie
Joined: 04 Nov 2012 Posts: 7
|
mqjeff wrote: |
It's confusing that you want to block only a single pathway in a cluster with an exit.
...
Otherwise, I do not believe that the rules for how to allocated data structures change for different types of exits. |
It is not 'blocking' what we want. We want to set message exit on senders side only for QMA - QMB communication in cluster. Message exit will be used for logging/auditing/debugging purposes.
If there is for example Security exit - it is called when channel starts and is "valid" till the channel is closed. So if I allocate memory in initialization phase I know when it won't be required - in termination phase and I can free it.
Channel AutoDefinition exit (CHADEX) is different in behaviour, as I understand it, that CHADEX is called when channel is automaticly defined by qmgr. In such situation message exit is started - modifies autodefined channel - and terminates. And after that qmgr starts autodefined channel.
And parameter I am modifying in CHADEX is "message exit ptr" of autodefined channel. To do it properly it seems I need to malloc memory and set value that will be used in this autodefined channel. OK, no problem so far. But now - CHADEX is terminating and what should I do? Does WMQ copies my modification to MQCD structure so I can free memory? Or memory allocated by me is really used in this autodefined channel, so I must not free it in CHADEX termination phase. So who frees it? QMGR itself? Or do I need some other exit that will do it sometime in future?
And why we got 'SIGSEGV: address not mapped((nil))' even though we set the variable in all CHADEX phases? Is it really ours FDC? I believe so, because if we remove this mallocs FDC is not generated. How should we read/understand that FDC?
Last edited by standapi on Tue Nov 06, 2012 4:16 am; edited 1 time in total |
|
Back to top |
|
 |
standapi |
Posted: Tue Nov 06, 2012 3:58 am Post subject: |
|
|
Newbie
Joined: 04 Nov 2012 Posts: 7
|
Mr Butcher wrote: |
i too had to use something similiar to get rid of exits on implicit build cluster sender channels. use this as a sample on your own risk
|
Thank you for the code, I appreciate it.
Although - we did also similar kind of tests - getting rid of MsgExits. We had also alter parameter: pCD->MsgExitsDefined = 0; to make it working. |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Nov 06, 2012 4:16 am Post subject: Re: Who is responsible for memory? |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
standapi wrote: |
mqjeff wrote: |
It's confusing that you want to block only a single pathway in a cluster with an exit.
|
It is not 'blocking' what we want. We want to set message exit on senders side only for QMA - QMB communication in cluster. Message exit will be used for logging/auditing/debugging purposes. |
Okay.
But it still doesn't make any sense to use an exit to do that. Nor to treat any path in a cluster separately from any other path.
At least to me.
So it still sounds like you are trying to do something using clusters, and exits, that can be better served by using a gateway pattern. |
|
Back to top |
|
 |
standapi |
Posted: Tue Nov 06, 2012 3:04 pm Post subject: Re: Who is responsible for memory? |
|
|
Newbie
Joined: 04 Nov 2012 Posts: 7
|
mqjeff wrote: |
standapi wrote: |
mqjeff wrote: |
It's confusing that you want to block only a single pathway in a cluster with an exit.
|
It is not 'blocking' what we want. We want to set message exit on senders side only for QMA - QMB communication in cluster. Message exit will be used for logging/auditing/debugging purposes. |
Okay.
But it still doesn't make any sense to use an exit to do that. Nor to treat any path in a cluster separately from any other path.
At least to me.
So it still sounds like you are trying to do something using clusters, and exits, that can be better served by using a gateway pattern. |
Thank you for your answer.
As I wrote - logging/auditing/debugging. We want to have an option to arbitrarily set/reset channel to log processed messages and we want it only for example during some specific tests and only between 2 specific qmgrs in the cluster. IMO it is not feasible to make such significant change as using gateway pattern just for this tests and in situation where WMQ provides technical solution how to do it. What we are looking for is more detailed documentation.
I appreciate you advise but in our scenario changing topology to use gateway qmgr seems to be overkill to what we want achieve. |
|
Back to top |
|
 |
RogerLacroix |
Posted: Tue Nov 06, 2012 3:09 pm Post subject: Re: Who is responsible for memory? |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
Hi,
I have read this post a couple of times and I still do not what you are trying to accomplish.
Do you want to
- remove a message exit?
- add a message exit?
standapi wrote: |
CHADEX is called when channel is automaticly defined by qmgr. |
True.
standapi wrote: |
In such situation message exit is started - modifies autodefined channel - and terminates. And after that qmgr starts autodefined channel. |
The message exit does NOT modify the "autodefined channel" definition. The only exit that can modify a channel definition is a Channel Auto-Definition exit.
I have good knowledge of how a Channel Auto-Definition exit works, as I have written (and sell) a Channel Auto-Definition exit (MQCACM) that handles send/receive/security/message exit configuration for whatever reason (i.e. cross-platform pathing, or adding an exit, etc..)
Regards,
Roger Lacroix
Capitalware Inc. _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
bruce2359 |
Posted: Tue Nov 06, 2012 3:29 pm Post subject: Re: Who is responsible for memory? |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
standapi wrote: |
We want to set message exit on senders side only for QMA - QMB communication in cluster. Message exit will be used for logging/auditing/debugging purposes. |
I'm as confused as others here.
If your goal is to capture message images for logging/auditing/debugging purposes, you want a message exit, and not a CHAD exit.
Exits can be enabled as needed; and disabled as needed. _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
RogerLacroix |
Posted: Tue Nov 06, 2012 3:42 pm Post subject: Re: Who is responsible for memory? |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
bruce2359 wrote: |
Exits can be enabled as needed; and disabled as needed. |
Not for cluster-sender channels. A cluster-sender channel retrieves its values from the cluster-receiver channel of the destination queue manager. If one is on Windows and the other is on Unix then the pathing information will be incorrect for the other platform.
Regards,
Roger Lacroix
Capitalware Inc. _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
bruce2359 |
Posted: Tue Nov 06, 2012 5:14 pm Post subject: Re: Who is responsible for memory? |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
RogerLacroix wrote: |
bruce2359 wrote: |
Exits can be enabled as needed; and disabled as needed. |
Not for cluster-sender channels. |
I yield to your expertise, Roger; but I'm confused. What is not for cluster-sender channels?
Message exits, send-exits and receive-exits are supported for cluster-sender and cluster-receiver channels, aren't they?
Are you saying that these exits cannot be enabled with the usual ALTER CHANNEL command? _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
RogerLacroix |
Posted: Tue Nov 06, 2012 5:41 pm Post subject: Re: Who is responsible for memory? |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
bruce2359 wrote: |
What is not for cluster-sender channels? |
You cannot define a cluster-sender channel with the required information.
bruce2359 wrote: |
Message exits, send-exits and receive-exits are supported for cluster-sender and cluster-receiver channels, aren't they? |
True.
bruce2359 wrote: |
Are you saying that these exits cannot be enabled with the usual ALTER CHANNEL command? |
True.
Think of the term "in your imagine". That is how IBM designed cluster-sender channel. When the sending queue manager needs to communicate with another member of the cluster, it goes to the cluster repository and retrieves the details of the cluster-receiver and builds the cluster-sender channel from that information. Strange but true - just remember the line "in your imagine".
Regards,
Roger Lacroix
Capitalware Inc. _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
bruce2359 |
Posted: Tue Nov 06, 2012 6:37 pm Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
Any alteration/definition/deletion of a cluster object (such as an exit) is propagated around the cluster. Stop/start of the channel would/should cause the change to take place - in this case, the launch of an exit. Would it not?
I'm trying to imagine ... _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
standapi |
Posted: Wed Nov 07, 2012 1:03 am Post subject: Re: Who is responsible for memory? |
|
|
Newbie
Joined: 04 Nov 2012 Posts: 7
|
RogerLacroix wrote: |
Do you want to
- remove a message exit?
- add a message exit?
|
First we would like to add message uxit in channel autodefinition exit (CHADEX)
RogerLacroix wrote: |
standapi wrote: |
In such situation message exit is started - modifies autodefined channel - and terminates. And after that qmgr starts autodefined channel. |
The message exit does NOT modify the "autodefined channel" definition. The only exit that can modify a channel definition is a Channel Auto-Definition exit.
|
My foult - "...situation message exit is started..." should be "...situation channel autodefinition exit is started..."
In CHADEX we are doing following:
There are fields in MQCD:
pCD->MsgExit ... AFAIK MsgExitPtr should be used instead this one
pCD->ExitNameLength ... length of each item in 'MsgExitPtr'
pCD->ExitDataLength ... length of each item in 'MsgUserDataPtr'
pCD->MsgExitsDefined ... if it's only ours exit used - we set here 1
pCD->MsgExitPtr ... problem
pCD->MsgUserDataPtr ... problem
We were unable to find in documentation how memory is managed for MsgExitPtr and MsgUserDataPtr.
If there is no message exit set on clus receiver the value MsgExitPtr and MsgUserDataPtr should be NULL. So we are adding message exit:
MsgExitPtr = malloc(ExitNameLength); MsgUserDataPtr = malloc(ExitDataLength); MsgExitsDefined = 1; and set correct content into the allocated memory.
But we were unable to find instruction in which phase of CHADEX we should allocate and set memory - MQXR_INIT / MQXR_AUTO_CLUSSDR / MQXR_TERM ?
And when we should to free it.
Can you please point us to some docs that covers it? |
|
Back to top |
|
 |
RogerLacroix |
Posted: Wed Nov 07, 2012 3:55 pm Post subject: |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
bruce2359 wrote: |
Any alteration/definition/deletion of a cluster object (such as an exit) is propagated around the cluster. |
True. If you define a message exit (i.e. /var/mqm/exits64/msgexit(ME) ) on a cluster-receiver channel on Unix/Linux then what will happen on Windows queue manager for a cluster-sender channel? It will fail. Because the message exit value gets propagated just as you say.
bruce2359 wrote: |
Stop/start of the channel would/should cause the change to take place - in this case, the launch of an exit. Would it not? |
No. Windows cannot find it. You need a message exit defined as C:\mystuff\msgexit(ME)
If you try and start the channel it will fail because of the invalid exit. So...... you say, I'm a smart guy, let me stop it and then ALTER the cluster-sender channel via runmqsc. You make your changes, start the channel and it fails again. You say WTF!! You do a DIS command and see that the value is wrong again. You say WTF!! You issue the ALTER again and it fails.
What is going on? (As I said, "in your imagine".) Every time you start the the cluster-sender channel, the sending queue manger requests and uses the exit values that are in the repository. It is like ground-hog day. Every time you start the channel it has the original values from repository. If you don't believe me, then try it.
I created MQCACM because a MQ security guru said, if you build it, they will come. Many people were supposedly using a free security exit but could not use it for their cluster channels. Anyway, not so many people care to secure their cluster channels.
Regards,
Roger Lacroix
Capitalware Inc. _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
|