Author |
Message
|
sushilinhere |
Posted: Wed May 19, 2010 1:10 am Post subject: Rollbacked Exception being Caught in Failure Terminal |
|
|
 Newbie
Joined: 17 Apr 2010 Posts: 2
|
Hey Guys
A flow starts with MqInput node and proceeds wit ha bunch of compute nodes and stuff.
The first compute node, which is present right after the MqInput node, has its failure terminal connected to a bunch of nodes.
Whats happening is :
When an exception(inbuilt/user ) is thrown by any node after this compute node , at times it rollbacks and enters the failure terminal of the first compute node. Its not consistent but it does happen..
We kinda changed our design due to this weird problem, Just thought ill share this exp with u guys and incase any one has any clues on why this is happenin do inform us!!
 |
|
Back to top |
|
 |
fatherjack |
Posted: Wed May 19, 2010 1:31 am Post subject: |
|
|
 Knight
Joined: 14 Apr 2010 Posts: 522 Location: Craggy Island
|
If this is indeed what's happening it is weird. The only time anything should go down the failure terminal is if the failure occurs in that node or you explicitly propagate to it. Failures after this node will roll back to the catch terminal of a previous trycatch node or your mqinput node.
Are you sure the failures aren't occurring in the compute node with the failure terminal connected up. _________________ Never let the facts get in the way of a good theory. |
|
Back to top |
|
 |
sushilishere |
Posted: Wed May 19, 2010 8:34 pm Post subject: |
|
|
 Apprentice
Joined: 27 Jul 2008 Posts: 36
|
Hey,
Yes we checked and double checked it.
In the first compute node . we propagate the output root explicitly. I guess it was taking everything that happened after that node in one single thread and when something was going wrong, at a later point, the thread as such went into failure mode. ( Purely on assumption/guess work and its open for any1 to provide the correct answer/explanation on this)
We just rearranged the flow so that only the default propagation happens ( Return true at the end of the first compute node) and now everything happens as its supposed to.  |
|
Back to top |
|
 |
Esa |
Posted: Wed May 19, 2010 11:23 pm Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
Yes,
this is how it goes. If you propagate explicitly and get an exception downstream, you get propagated to failure terminal if it is wired.
You can think it as if your ESQL code is implicitly wrapped within a try catch block. When you propagate with ESQL PROPAGATE, the compute node calls the next node, and after the whole path has executed, the call returns to your ESQL. This is because message flows always execute in one single thread. If an exception is catched and failure terminal is connected, the node wired to it gets called.
If your ESQL returns true, the next node is called WITHOUT a try-catch. If you get an exception, the whole call chain returns to the first input node, which calls the node that is possibly wired to its catch terminal.
In a java compute node you can use try-catch within your code and get more control in exception handling, but that is not possible with ESQL. |
|
Back to top |
|
 |
sushilishere |
Posted: Wed May 19, 2010 11:30 pm Post subject: |
|
|
 Apprentice
Joined: 27 Jul 2008 Posts: 36
|
Thank you..
ARigato and Danke.
Finally my confusion/assumption has turned kinda right ( which is still a big big bad news for me)
Thanks a lot Dude..!!! .. you just saved a development venture
 |
|
Back to top |
|
 |
Esa |
Posted: Wed May 19, 2010 11:46 pm Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
What about setting a flag (in LocalEnvironment for example) before PROPAGATE and clearing it after the call? That way you could move the bunch of nodes from failure path to the input nodes catch and use a filter or route node to route the execution there if when the flag is up? |
|
Back to top |
|
 |
sushilishere |
Posted: Wed May 19, 2010 11:59 pm Post subject: |
|
|
 Apprentice
Joined: 27 Jul 2008 Posts: 36
|
I thought that the Local environment values are reverted to the older values(the ones present before it enters the node), once an exception is thrown inside the node. Only the Environment values remain set even in the case of rollback!!
But then your design suggestion would work well with just a single point of error handling.
hope my assumption on the local environment is wrong  |
|
Back to top |
|
 |
Esa |
Posted: Thu May 20, 2010 12:19 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
You can use Environment as well if you want to be sure.
But since this is the first compute node after MQInput, any variables you set in InputLocalEnvironment should be visible in the input nodes catch - regardless of the compute mode of your compute node. Unless there are some other nodes in between that may have allocated a new LocalEnvironment.
Well, some people may say that using LocalEnvironment here instead of Environment is an overkill and they are probably right. |
|
Back to top |
|
 |
sushilishere |
Posted: Thu May 20, 2010 12:44 am Post subject: |
|
|
 Apprentice
Joined: 27 Jul 2008 Posts: 36
|
Thanks again.
Will post back incase "we use this design" and everything turns out to be 'A' ok
 |
|
Back to top |
|
 |
Esa |
Posted: Thu May 20, 2010 12:47 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
Sorry,
I think I misguided you a bit. You probably should leave you bunch of nodes in place in the failure path and use the Environment flag there to figure out if the exception happened in your ESQL code or downstream... |
|
Back to top |
|
 |
sushilishere |
Posted: Thu May 20, 2010 1:07 am Post subject: |
|
|
 Apprentice
Joined: 27 Jul 2008 Posts: 36
|
Does this mean the local environment will not hold the value when exception is thrown in that node or is using the environment a better choice by all means!!?? |
|
Back to top |
|
 |
Esa |
Posted: Thu May 20, 2010 2:22 am Post subject: Re: Rollbacked Exception being Caught in Failure Terminal |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
No, you can select yourself which one you want to use. Environment is a safe bet, because everything you set there will be visible everywhere. If you use LocalEnvironment, you will have to understand how it works. LocalEnvironment is basicly ment for scoping variable visibility within the flow, and I think there are very few cases when you actually need to use it ( except for showing off that you master advanced topics, that's what I use it for )
sushilinhere wrote: |
The first compute node, which is present right after the MqInput node, has its failure terminal connected to a bunch of nodes.
|
Having a bunch of nodes wired to a failure terminal usually means that you want to recover locally from some exceptions and continue normal operation. That may be easier to do if you leave the bunch in place and use the Environment flag for detecting if you should try to recover or just re-throw.
If you move the recovery bunch to input nodes catch path, continuing normal operation may become trickier. What happens if you get another exception downstream after the recovery? You will have to add a TryCatch node etc... |
|
Back to top |
|
 |
sushilishere |
Posted: Sun May 23, 2010 7:58 pm Post subject: |
|
|
 Apprentice
Joined: 27 Jul 2008 Posts: 36
|
Thanks for the Help .. will have check on few scenarios now.. Back to Testing  |
|
Back to top |
|
 |
|