Rest API not returning after Update of an entity

Hi Everyone,

We have entity that gets updated from another source using REST API. We have registered a listener for entitychanged events of that entity in the middleware. Whenever we receive after commit event we send an event to web module using global events add on.
In this flow at times we observed that the REST API which is invoked from another source is not returning.

Below is the code snipped in middleware for entity change event

@Async
@TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT)
private void afterCommit(EntityChangedEvent<Submission, Long> event) {
String message = “Submission:”+event.getEntityId().getValue().toString();
events.publish(new UiNotificationEvent(this, Strings.isNullOrEmpty(message) ? “test” : message));

}

Below are the logs:

2022-03-22 14:42:43.632 DEBUG [default task-79/app-core/admin] com.haulmont.cuba.core.app.RdbmsStore - load: metaClass=rioc_Submission, id=54273, view=com.entity.Submission/
2022-03-22 14:42:43.632 DEBUG [default task-79/app-core/admin] com.haulmont.cuba.core.app.RdbmsStore - commit: commitInstances=[entity.Submission-54273 [detached]], removeInstances=[]
2022-03-22 14:42:43.648 DEBUG [default task-79/app-core/admin] com.haulmont.addon.globalevents.core.WebSocketServer - Sending UiNotificationEvent{message=‘Submission:54273’, source=SubmissionEntityChangeListener@5bdd06db} to {WebSocketServerSockJsSession[id=b0d12d67e04841b6af60096ac1faeb27]=true, WebSocketServerSockJsSession[id=d8d710ec692f40d3820018e4c4983f87]=true}
2022-03-22 14:42:43.648 DEBUG [default task-79/app-core/admin] com.haulmont.addon.globalevents.core.WebSocketServer - Sending message TextMessage payload=[rO0ABXNyAC…], byteCount=740, last=true] to WebSocketServerSockJsSession[id=b0d12d67e04841b6af60096ac1faeb27]
2022-03-22 14:43:16.523 INFO [default task-80/app-core/server] com.haulmont.cuba.security.auth.AuthenticationManagerBean - Logged in:

After the event is sent to web module the application is hanged and there are logs for about 1minute.
This issue is happening randomly.

Could you please help us in resolving the issue.

We are using cuba platfrom 7.0.12

Thanks in advance for the support

Below is the code in the web module for handling the event from middle tier

@Async
@EventListener
public void onUiNotificationEvent(UiNotificationEvent event) {

    submissioneditorController.info("Received  event id is "+ event.getMessage());
    if(!event.getMessage().contains("Submission")){
            submissioneditorController.debug("Event received from other source");
            return;
    }
    String[] splits = event.getMessage().split(":");
    Long recvdId = Long.parseLong(splits[1]);


    Submission currItem = submissionDc.getItem();


    if(recvdId.compareTo(submissionDc.getItem().getId()) == 0) {

            Submission sub = dataManager.reload(submissionDc.getItem(), "submission-view");
         
            submissionDl.setEntityId(sub);
            dataContext.merge(sub);
                    submissionDc.setItem(sub);//sub.setVersion(sub.getVersion()+1);


    }else{
            submissioneditorController.info("current item is null in uinotification event");
    }

}

Hi @paddu.bits

I would recommend removing @Async annotations as they seem superfluous because global events are delivered asynchronously anyway. Also, try to add more logging to narrow down the point where the system hangs.