Hi,
We’re using Jmix 2.5.2 with BPM, and we’ve run into a blocking issue related to UiEventPublisher.publishEvent()
that is internally called by TaskCompletionImpl.complete()
.
When a user completes a BPM task, occasionally the request thread gets stuck trying to lock the VaadinSession
.
Here is an excerpt from the thread dump:
"http-nio-8204-exec-1" #70
java.lang.Thread.State: WAITING (parking)
at com.vaadin.flow.server.VaadinSession.lock(VaadinSession.java:730)
at io.jmix.flowui.sys.SessionHolder.getVaadinSessionState(SessionHolder.java:130)
at io.jmix.flowui.sys.SessionHolder.getActiveSessionsForUsernames(SessionHolder.java:70)
at io.jmix.flowui.UiEventPublisher.publishEventForUsersInternal(UiEventPublisher.java:91)
at io.jmix.flowui.UiEventPublisher.publishEvent(UiEventPublisher.java:146)
at io.jmix.bpmflowui.processform.TaskCompletionImpl.complete(TaskCompletionImpl.java:97)
at io.jmix.bpmflowui.processform.TaskCompletionImpl.complete(TaskCompletionImpl.java:97)
at at com.creas.fobombpm.view.cmftaskapprovalform.CmfTaskApprovalForm.onApproveBtnClick(CmfTaskApprovalForm.java:136)
In the attached full thread dump, I see a couple of threads blocked in UiEventPublisher.publishEvent()
(line 146), all waiting for VaadinSession.lock()
.
The strange part is that this is not easy to reproduce.
- In ~20 days, we saw around 5-6 “zombie” sessions stuck in this state.
- During the same period, the system successfully processed maybe 10,000+ task completions without issue.
- So it’s not deterministic (I cannot say “every time I approve a task, it happens”), but it does happen eventually.
In a previous project I faced a similar freeze when publishing UI events, and solved it by switching from UiEventPublisher.publishEvent()
to publishEventForCurrentUi()
. That avoided session locking issues.
I understand why publishEvent()
is used here: in BPM it makes sense to notify all active sessions If one user completes the task, the task list in other user sessions should be updated immediately.
Thanks in advance.
threaddump.txt (2.3 MB)