[ 
https://issues.apache.org/jira/browse/CAUSEWAY-3775?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17854007#comment-17854007
 ] 

Daniel Keir Haywood commented on CAUSEWAY-3775:
-----------------------------------------------

updated simpleapp:

 

@Action(semantics = SemanticsOf.SAFE)
@RequiredArgsConstructor
public class SimpleObject_throw {

    private final SimpleObject simpleObject;

    @MemberSupport
    public SimpleObject act(final String message) {
         
backgroundService.execute(backgroundCommandActions).throwWithMessage(message);
        return simpleObject;
    }

    @Inject private BackgroundCommandActions backgroundCommandActions;
    @Inject private BackgroundService backgroundService;

}

 

calling:

@Named(SimpleModule.NAMESPACE + ".BackgroundCommandActions")
@DomainService
@Priority(PriorityPrecedence.EARLY)
@RequiredArgsConstructor(onConstructor_ = \{@Inject} )
@Log4j2
public class BackgroundCommandActions {

    @Action(semantics = SemanticsOf.SAFE)
    @ActionLayout(promptStyle = PromptStyle.DIALOG_SIDEBAR)
    public void throwWithMessage(final String message) {
        throw new RuntimeException(message);
    }

}

 

what I see is that an exception is logged, and in the database the 
CommandLogEntry is updated with the exception and the completedAt. 

HOWEVER, somewhat amusingly the startedAt is null.    Why?  because that would 
have been set in the transcation that was rolled back.

In the code that then looks for commands, this is implemented as:

    @NamedQuery(
            name  = Nq.FIND_BACKGROUND_AND_NOT_YET_STARTED,
            query = "SELECT cl "
                  + "  FROM CommandLogEntry cl "
                  + " WHERE cl.executeIn = 
org.apache.causeway.extensions.commandlog.applib.dom.ExecuteIn.BACKGROUND "
                  + "   AND cl.startedAt is null "
                  + " ORDER BY cl.timestamp ASC"),

rather than checking for a null completedAt.

And therefore, we go into an endless loop.

 

this behaviour is actually what we want going forward.

 

 

 

> Suspect that failure of background command results in locks being held as 
> attempt to sync exception.
> ----------------------------------------------------------------------------------------------------
>
>                 Key: CAUSEWAY-3775
>                 URL: https://issues.apache.org/jira/browse/CAUSEWAY-3775
>             Project: Causeway
>          Issue Type: Bug
>          Components: Core, Ext Core CommandLog
>    Affects Versions: 2.0.0
>            Reporter: Daniel Keir Haywood
>            Assignee: Daniel Keir Haywood
>            Priority: Minor
>             Fix For: 2.1.0
>
>




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to