VaadinSession lock contention causing periodic server hang (Jmix 2.6, Vaadin Flow)

Hi everyone,
I’m facing a periodic “server hang” issue in a Jmix (2.6) + Vaadin Flow application.
I collected several thread dumps during the freeze, and the pattern is always the same.

What I see in the thread dumps:

• Many threads are stuck waiting inside:
com.vaadin.flow.server.VaadinSession.lock()
io.jmix.flowui.sys.SessionHolder.getVaadinSessionState()
io.jmix.flowui.UiEventPublisher.publishEventForUsersInternal()

• Example of dump

thread-dump-1-2025-11-18-134017.txt (595.3 KB)
thread-dump-2-2025-11-18-134017.txt (662.9 KB)
thread-dump-3-2025-11-18-134017.txt (681.8 KB)

• All Tomcat request threads eventually block
• UI stops responding
• Server appears alive but becomes completely frozen
• No CPU spike, no deadlock → just long-running session locks

My assumptions:

VaadinSession-level locking looks too aggressive when:

• Hazelcast cluster events are published,
• UiEventPublisher tries to reach multiple sessions,
• background threads attempt UI access indirectly.

This creates a long queue of waiting threads, which leads to a hang-like state.

Questions:

  1. Is this a known issue in Jmix 2.6 or Vaadin Flow regarding session locking?
  2. Should UI event publishing be avoided from Hazelcast listener threads?
  3. Is there a recommended way to decouple cluster events from VaadinSession locks?
  4. Any guidance on how to reduce lock contention or configure safer async event handling?

Hi Asadbek,

This issue has been fixed in Jmix 2.7.0, see Do not lock session to get its state · Issue #4632 · jmix-framework/jmix

If you cannot upgrade immediately, use the workaround explained in the issue.

Regards,
Konstantin