You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by Prasad Jeewantha <je...@gmail.com> on 2013/07/08 09:16:29 UTC

Re: How does fault handling work in synapse?

Hi Hiranya,

Sorry for the late response, was really busy with the release work at
office :(.

One thing I observed when debugging synapse with sample 57 was that, when
all 3 endpoints were running, the *onFault()* method in *
DynamicLoadbalanceFaultHandlerImpl* inner class was *not* hit. But when one
endpoint was turned down, for every message the onFault() method was called
continuously. When the last endpoint was also turned down, *
synCtx.getFaultStack()* in *onFault()* method returned an empty stack hence
*faultStack.pop()* caused an *EmptyStackException*. Thats why I added a *
faultStack.isEmpty()* check in the fix.

There seems to be an inconsistency in pushing and popping FaultHandlers
from the stack.

Jeewantha




On Tue, Jun 25, 2013 at 11:53 PM, Hiranya Jayathilaka
<hi...@gmail.com>wrote:

> This seems to be a bug in the trunk and the last release. I ran into the
> same problem a couple of times running some other scenarios. Need to dig a
> little deeper before we can say what's exactly going on here.
>
> I wonder how the fault stack became empty in this case. Did you find
> anything useful with regard to that during your debugging session? Which
> component/class is popping the fault stack before the onFault method here?
>
> Thanks,
> Hiranya
>
> On May 31, 2013, at 4:29 AM, Prasad Jeewantha <je...@gmail.com>
> wrote:
>
> Hi All,
>
> There is an issue in synapse which Im trying to solve where I get an
> EmptyStackException when running this sample
> http://synapse.apache.org/Synapse_Samples.html#Sample57.
>
> Here is the stacktrace.
>
> java.util.EmptyStackException
>     at java.util.Stack.peek(Stack.java:85)
>     at java.util.Stack.pop(Stack.java:67)
>     at
> org.apache.synapse.endpoints.DynamicLoadbalanceEndpoint$DynamicLoadbalanceFaultHandlerImpl.onFault(DynamicLoadbalanceEndpoint.java:506)
>     at org.apache.synapse.FaultHandler.handleFault(FaultHandler.java:54)
>     at
> org.apache.synapse.endpoints.AbstractEndpoint.invokeNextFaultHandler(AbstractEndpoint.java:618)
>     at
> org.apache.synapse.endpoints.AbstractEndpoint.onFault(AbstractEndpoint.java:467)
>     at
> org.apache.synapse.endpoints.AddressEndpoint.onFault(AddressEndpoint.java:43)
>     at org.apache.synapse.FaultHandler.handleFault(FaultHandler.java:102)
>     at
> org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:243)
>     at
> org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:166)
>     at
> org.apache.synapse.transport.passthru.TargetErrorHandler$1.run(TargetErrorHandler.java:132)
>     at
> org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
>     at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>     at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>     at java.lang.Thread.run(Thread.java:662)
>
> What I saw while debugging was that when an endpoint *send(Msgctx)*method is invoked, a fault handler is pushed to a stack in MessageContext.
> When the message goes to another endpoint, another fault handler will be
> pushed to the stack in the *send(Msgctx) *method of the second endpoint.
> But as far as I figured out, the fault handlers are poped from the stack
> only when a fault occurs, i.e. in the *onFalut()* method of a fault
> handler.
>
> My question is, should'nt we pop a fault handler from the stack, when the
> message goes out from an endpoint? Otherwise how do we figure out which
> fault handler in the stack belongs to which endpoint?
>
> It would be great if someone can explain me briefly the architecture of
> fault hanlding in synapse. Any help is appreciated.
>
> Thanks,
> PJ
>
>
>
>
>
>
> --
> Hiranya Jayathilaka
> Mayhem Lab/RACE Lab;
> Dept. of Computer Science, UCSB;  http://cs.ucsb.edu
> E-mail: hiranya@cs.ucsb.edu <hi...@wso2.com>;  Mobile: +1 (805) 895-7443
> Blog: http://techfeast-hiranya.**blogspot.com<http://techfeast-hiranya.blogspot.com/>
>
>