| Author | Message | 
		
		  | mikepham | 
			  
				|  Posted: Wed Mar 24, 2010 2:48 am    Post subject: Doing traverse xml message made the broker shutdown |   |  | 
		
		  |  Novice
 
 
 Joined: 17 Mar 2010Posts: 20
 
 
 | 
			  
				| Hi everyone 
 I'm using this piece of code below to traverse xml message to modify the content of elements
 
 
 
   
	| Code: |  
	| CREATE PROCEDURE Traverse (IN REF_Cursor REFERENCE) BEGIN 
 IF (FIELDTYPE(REF_Cursor) = XML.CDataSection) THEN
 -- change the field type of the content to 'Value'
 SET REF_Cursor TYPE = Value;
 END IF;
 
 MOVE REF_Cursor FIRSTCHILD ;
 IF LASTMOVE(REF_Cursor) THEN
 CALL Traverse(REF_Cursor);
 MOVE REF_Cursor PARENT;
 END IF;
 
 MOVE REF_Cursor NEXTSIBLING ;
 IF LASTMOVE(REF_Cursor) THEN
 CALL Traverse(REF_Cursor);
 MOVE REF_Cursor PREVIOUSSIBLING;
 END IF;
 
 END;
 |  It worked fine on Windows environment. However, when I deployed msgflow contain this piece of code above to Unix-AIX environment, it caused error
 
 
 
   
	| Code: |  
	| The broker has detected that the Execution Group default has shutdown. Message broker internal error: diagnostic information 'DynamicSubscript
 ionEngine' /build/S610_P/src/DataFlowEngine/JavaNodeLibrary/ImbPubSubDatabase.cpp: 245: ImbPubSubDatabase::ImbPubSubDatabase
 : DynamicSubscriptionEngine: DynamicSubscriptionEngine BIP2321E: Database error: ODBC return code '-1'.
 |  
 Do you have any idea on this problem and how to fix it ?
 Not sure if the traverse code above made the broker failed
 
 WMB 6.1's running on both environments
 
 Thank you
  
 Last edited by mikepham on Wed Mar 24, 2010 7:21 pm; edited 2 times in total
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | Gaya3 | 
			  
				|  Posted: Wed Mar 24, 2010 3:01 am    Post subject: Re: Doing traverse xml message made the broker shutdown |   |  | 
		
		  |  Jedi
 
 
 Joined: 12 Sep 2006Posts: 2493
 Location: Boston, US
 
 | 
			  
				| 
   
	| mikepham wrote: |  
	| 
 
   
	| Code: |  
	| The broker has detected that the Execution Group default has shutdown. Message broker internal error: diagnostic information 'DynamicSubscript
 ionEngine' /build/S610_P/src/DataFlowEngine/JavaNodeLibrary/ImbPubSubDatabase.cpp: 245: ImbPubSubDatabase::ImbPubSubDatabase
 : DynamicSubscriptionEngine: DynamicSubscriptionEngine BIP2321E: Database error: ODBC return code '-1'.
 |  [/code]
 |  
 why it is throwing Database error
 check out this
 http://www.mqseries.net/phpBB/viewtopic.php?p=128076&sid=d1e4397c628a4173032254f44bd46519
 _________________
 Regards
 Gayathri
 -----------------------------------------------
 Do Something Before you Die
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | mikepham | 
			  
				|  Posted: Wed Mar 24, 2010 4:04 am    Post subject: |   |  | 
		
		  |  Novice
 
 
 Joined: 17 Mar 2010Posts: 20
 
 
 | 
			  
				| Thank you for the link I will look into it for the db issue
 
 Do you think the recursion code above can make broker failed and shutdown ?
 I read somewhere in this forum and looks like using recursion can affect broker
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | Gaya3 | 
			  
				|  Posted: Wed Mar 24, 2010 4:18 am    Post subject: |   |  | 
		
		  |  Jedi
 
 
 Joined: 12 Sep 2006Posts: 2493
 Location: Boston, US
 
 | 
			  
				| 
   
	| mikepham wrote: |  
	| Thank you for the link I will look into it for the db issue
 
 Do you think the recursion code above can make broker failed and shutdown ?
 I read somewhere in this forum and looks like using recursion can affect broker
 |  
 recursion always affect the performance...its good to avoid it and use some other way.
 _________________
 Regards
 Gayathri
 -----------------------------------------------
 Do Something Before you Die
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | kimbert | 
			  
				|  Posted: Wed Mar 24, 2010 6:01 am    Post subject: |   |  | 
		
		  |  Jedi Council
 
 
 Joined: 29 Jul 2003Posts: 5543
 Location: Southampton
 
 | 
			  
				| 
  I don't think it can be avoided in this case. 
	| Quote: |  
	| recursion always affect the performance...its good to avoid it and use some other way. |  |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | mikepham | 
			  
				|  Posted: Thu Mar 25, 2010 1:36 am    Post subject: |   |  | 
		
		  |  Novice
 
 
 Joined: 17 Mar 2010Posts: 20
 
 
 | 
			  
				| Hi kimber and Gaya 
 I think I figured out why the broker shutdown in Unix-AIX environment
 It sounds kind of strange
 
 If the input xml file like this use as input for the traverse method above. It will make the broker shutdown and failed
 
 
 
   
	| Code: |  
	| <A> <B>
 <C>Test</C>
 </B>
 </A>
 |  
 But, when I tried with the input xml file below, it worked well
 
 
   
	| Code: |  
	| <A><B><C>Test</C></B></A> |  
 Both input xml files worked well in Windows-PC
 
 Looks like the spaces, tabs in the input xml file made the traverse method using recursion failed in Unix-AIX environment. I'm not sure...
 
 So, in order to temporary fix this problem, I need the input xml file to be normalized, without any spaces, tabs between elements
 
 Could you two help me on this ?
 
 I'm using xmlns domain
 
 Thanks
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | Gaya3 | 
			  
				|  Posted: Thu Mar 25, 2010 2:16 am    Post subject: |   |  | 
		
		  |  Jedi
 
 
 Joined: 12 Sep 2006Posts: 2493
 Location: Boston, US
 
 | 
			  
				| some thing ...some thing  Strange.....????   
 Do we need to Raise a PMR for this ? is it a product Bug [But its working in Windows OS] or any OS Patch required.
 _________________
 Regards
 Gayathri
 -----------------------------------------------
 Do Something Before you Die
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | WMBDEV1 | 
			  
				|  Posted: Thu Mar 25, 2010 3:12 am    Post subject: |   |  | 
		
		  | Sentinel
 
 
 Joined: 05 Mar 2009Posts: 888
 Location: UK
 
 | 
			  
				| It does sounds odd. Can you provide a user trace of the flow for both the file that works and also the one that doesnt? 
 Is the message tree thats built within broker the same in both cases? Try dumping ${Root} to confirm / deny this.
 
 If it really is the case that the file with spaces in doesnt work but the other does, then a PMR may be the way to go but i'd check the ideas above for clues first
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | kimbert | 
			  
				|  Posted: Thu Mar 25, 2010 3:21 am    Post subject: |   |  | 
		
		  |  Jedi Council
 
 
 Joined: 29 Jul 2003Posts: 5543
 Location: Southampton
 
 | 
			  
				| 
   
	| Quote: |  
	| Do you have any idea on this problem and how to fix it ? |  Check your recursive walk algorithm. I think it's incorrect. In particular, it looks to me as if the MOVE REF_Cursor PREVIOUSSIBLING; is the source of the infinite loop. I can't explain why you don't see the problem on Windows, but the answer might emerge once you understand why it's failing on Unix.
 
 A Trace node should help you to understand what mixed content looks like in the message tree, if you don't already know.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | mikepham | 
			  
				|  Posted: Mon Mar 29, 2010 2:18 am    Post subject: |   |  | 
		
		  |  Novice
 
 
 Joined: 17 Mar 2010Posts: 20
 
 
 | 
			  
				| Hi kimbert 
 You're probably right. I double checked the traverse method and looked like the statement below was redundant
 
 
 
   
	| Code: |  
	| MOVE REF_Cursor PREVIOUSSIBLING; |  
 I removed it and test again the method in AIX-Unix environment. However I still got the same problem made broker shutdown and restart. Very strange that it worked fine on Windows
 
 I finally decided to re-write the traverse method. This time it looked simpler and worked fine on both Windows and Unix. It also achieved my goal
 
 
 
 
   
	| Code: |  
	| CREATE PROCEDURE traverse(IN root REFERENCE) BEGIN 
 IF (FIELDTYPE(root) = XML.CDataSection) THEN
 -- change the field type of the content to 'Value'
 SET root TYPE = Value;
 END IF;
 
 DECLARE cursor REFERENCE TO root;
 MOVE cursor FIRSTCHILD;
 
 WHILE LASTMOVE(cursor) DO
 CALL traverse(cursor);
 MOVE cursor NEXTSIBLING;
 END WHILE;
 END;
 |  
 Hopefully it will not cause any other issue
  |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | fjb_saper | 
			  
				|  Posted: Mon Mar 29, 2010 7:54 am    Post subject: |   |  | 
		
		  |  Grand High Poobah
 
 
 Joined: 18 Nov 2003Posts: 20767
 Location: LI,NY
 
 | 
			  
				| @mikepham Your recursivity algorithm looks much better now. This should do the trick.  Have fun  _________________
 MQ & Broker admin
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | mikepham | 
			  
				|  Posted: Mon Mar 29, 2010 9:16 am    Post subject: |   |  | 
		
		  |  Novice
 
 
 Joined: 17 Mar 2010Posts: 20
 
 
 | 
			  
				| 
   
	| fjb_saper wrote: |  
	| @mikepham Your recursivity algorithm looks much better now. This should do the trick.  Have fun  |  
 thank you, my friend
  |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  |  |