hazelcast-fix #515

Merged
scion merged 5 commits from hazelcast-fix into master 2026-06-03 10:15:35 -07:00
Owner
  • Actually use Hazelcast for shared attributes between servers
  • Add documentation for clustering
  • Add example compose file for multiple servers
  • Change client.js to make auto-deleting queues in RabbitMQ

I discovered a bug in Spring that prevents me from testing whether clustering works. If you log in two characters on the same account on different servers, they can't talk to one another because Spring won't broadcast a message when the user exists locally, even if the destination session isn't local. See #511 for more info.

* Actually use Hazelcast for shared attributes between servers * Add documentation for clustering * Add example compose file for multiple servers * Change client.js to make auto-deleting queues in RabbitMQ I discovered a bug in Spring that prevents me from testing whether clustering works. If you log in two characters on the same account on different servers, they can't talk to one another because Spring won't broadcast a message when the **user** exists locally, even if the destination session isn't local. See #511 for more info.
Previously SessionAttributeService stored session attributes in a local
HashMap, meaning each server node only saw attributes for WebSocket
sessions connected to it. This caused broken behavior in multi-server
deployments:

- EchoService.echoToAll() sent messages with missing session attributes
  to players on other servers
- CharacterJanitor incorrectly kicked connected players (their attributes
  appeared empty on the wrong server) or missed actually-disconnected
  ones
- CommService.sendTo() and executeCommandAs() silently failed when the
  target character was connected to a different server

The fix injects the existing HazelcastInstance bean and stores session
attributes in a distributed IMap ("mud-session-attributes") so all
cluster nodes share the same session attribute store.

SessionAttributeServiceTest was also updated to use a real embedded
Hazelcast instance instead of mocking the IMap, ensuring the actual
distributed map behavior is exercised.
The concurrency-and-synchronization doc previously described
SessionAttributeService as a per-server in-memory HashMap with known
cross-server limitations (dropped messages, incorrect janitor
detection). Now that it uses a shared Hazelcast IMap, update the
documentation to:

- Rename the section from 'The Session Attribute Problem' to
  'Session Attribute Storage'
- Update the code example to show Hazelcast IMap usage
- Update the sendTo() cross-server scenario to show it now works
  correctly
- Remove the two now-resolved limitations from the Known
  Multi-Server Limitations list (cross-server sendTo() drops and
  stale janitor detection)
- Update the janitor cleanup section to explain the fix
- Update the concurrency summary table row for cross-server
  delivery

Also update event-timer-system.md to reference the Hazelcast-backed
map instead of 'in-memory map'.
make RabbitMQ queues auto-deleting and add an example compose for multiple servers
All checks were successful
CI Build & Test / build-and-test (pull_request) Successful in 13m57s
0b1ddc0d7e
scion merged commit 0a74fa807a into master 2026-06-03 10:15:35 -07:00
scion deleted branch hazelcast-fix 2026-06-03 10:15:35 -07:00
Sign in to join this conversation.
No description provided.