[ https://issues.apache.org/jira/browse/ODE-1066?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16012692#comment-16012692 ]
Igor Vorobiov commented on ODE-1066: ------------------------------------ *1)* The problem with unstable work of compensation activity occurs because we lose compensations(due to incorrectly defined compareTo for CompensationHandler) in the following place: {code:title=SEQUENCE.java|borderStyle=solid} ACTIVE.run().new ParentScope() {...}.completed(FaultData, Set<CompensationHandler>) { TreeSet<CompensationHandler> comps = new TreeSet<CompensationHandler>(_compensations); comps.addAll(compensations); ... } {code} It means that two different compensations can be equal if time difference is the same(that.scopeStartTime - this.scopeEndTime). See CompensationHandler. The issue is reproduced when compensated scope is not specified for parent. It means that all successfully finished child scopes should be compensated. {code:xml} <compensate name="ParensScope" /> {code} Seems that this mistake is done here: [https://github.com/apache/ode/commit/a271c9fe3f4b430b8902408f0bce426f8c7512a7] *2)* Second problem can be noticed for the case when particular child scope should be compensated. {code:xml} <compensate name="ParensScope" scope="s1-scope" /> {code} It works incorrectly. All child scopes are compensated in this case because selected scope is not initialized on compilation phase in CompensateGenerator. And at run time we have always scope == null: {code:title=SCOPE.java|borderStyle=solid} findCompensationData(OScope scope) { ... if (null == scope || ch.compensated.oscope.equals(scope)) out.add(ch); ... } {code} Attached patches for both problems. > Unstable work of compensation activity > -------------------------------------- > > Key: ODE-1066 > URL: https://issues.apache.org/jira/browse/ODE-1066 > Project: ODE > Issue Type: Bug > Components: BPEL Runtime > Affects Versions: 1.3.6 > Environment: Win7x64, Java 1.8.0_111, Tomcat 7.0.73 > Reporter: Vitaliy Tkachenko > Attachments: FlightReservationProcess.zip, > ODE-1066-CompensateGenerator.patch, ODE-1066-CompensationHandler.patch > > > Compensation doesn't work appropriately, there is no guarantee that it will > be processed on execution. It doesn't matter which BPEL version is used > either 1.1 or 2.0 and which method is used to provide the compensation > (either "compensate" or "compensateScope"). > If there are several scopes to compensate the most big chance to work out its > compensation handler has the last scope - it fails rarely but scopes defined > prior to the last scope have much bigger chances to fail. When compensation > fails nothing is seen in the log, it just doesn't work. > Attaching the FlightReservationProcess application to reproduce the bug. > Specify "all" in the input to execute compensation for all scopes, call it > many times and check how scopes are compensated. Each result 4, 5, 6 must > contain "1" if the corresponding scope "car", "hotel" , "asbstract" has been > compensated. But in reality the most big probability "abstract" scope has to > include "1", it fails having the "0" pretty rarely. But other scopes "car" > and "hotel" fail oftenly, only in rare cases they contain "1" as being > compensated. You can also play including "car", "hotel", "abs" instead of all > to compensate only specified scopes. E.g. use "car hotel" in the input to > compensate these 2 scopes only. -- This message was sent by Atlassian JIRA (v6.3.15#6346)