Skip to content

System events are silently dropped when several are sent to the same WebSocket sessions at once #37790

Open

Description

@zJaaal

Problem Statement

System events are dropped, silently, when several are sent to the same WebSocket sessions at the same time. The server logs nothing.

SystemEventsWebSocketEndPoint.sendSystemEvent is called directly on the thread that publishes each event (SystemEventsFactory.java:247). It loops over every open session and calls session.getAsyncRemote().sendObject(...) without waiting for that session's previous send to finish, and without checking the result the call returns. When many jobs finish in the same second, many threads send to the same sessions concurrently, and some messages never reach the browser.

Who it affects: any author with more than one tab open, or with several background runs finishing together, and every feature that learns an outcome from a pushed event. In Content Drive (#37062, #37761), a page that misses a folder delete, folder duplicate or bulk upload completion keeps the folder marked as in flight, or keeps its "running" status, until the author reloads. The bell notification is not lost, because it is persisted and read back on load, but the live toast and the listing refresh are.

Why it had not surfaced: a single run finishing on its own is delivered fine. It takes a burst. The Content Drive e2e suite produces one, since its tests run in parallel as the same user, and its reload tests fail intermittently in CI because of it.

Steps to Reproduce

Reproduced on a local instance of the dotcms/dotcms:trunk image, on one node:

  1. Open five admin pages for the same user (each opens its own session on /api/ws/v1/system/events), and record the frames each page receives.
  2. Submit 20 bulk folder deletes at once: POST /api/v1/assets/folders/_bulkdelete, one folder each.
  3. All 20 jobs finish with SUCCESS, within one second of each other.
  4. Count the BULK_FOLDER_DELETE_COMPLETED frames each page received:
Page Completions received
1 15 of 20
2 16 of 20
3 15 of 20
4 15 of 20

Different pages miss different events. The frames were recorded at the browser, so they never left the server. Nothing was logged: no An error occurred when sending a message through the SystemEventsWebSocketEndPoint line, and no other error.

On a cloud test environment (one node), the same thing happened twice during e2e runs: 5 or 6 jobs finished in the same second, and a completion sent in or just after that burst never reached the page it was meant for, while that page did receive other events.

The probe used for the reproduction was a throwaway Playwright spec. It can be shared on request.

Acceptance Criteria

  • Sends to one session are serialized: a send starts only after that session's previous send has completed, or is queued behind it.
  • A failed send is logged, for that session only, and does not stop the event going to the remaining sessions. Today a throw ends the loop for every session after the failing one, because the try wraps the whole loop.
  • The result of each async send is checked, so a failure cannot be silent.
  • An integration test publishes a burst of events concurrently, with several sessions for one user open, and every session receives every event.

dotCMS Version

Latest from main (trunk image). SystemEventsWebSocketEndPoint.sendSystemEvent has not changed in years, so released versions are very likely affected too.

Severity

Medium - Some functionality impacted

Links

Issue written by Claude (Claude Code) on behalf of @zJaaal.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions