canary/docs/systems
Eduardo Dantas d9fba17031
fix(network): retry rejected protocol cleanup (#4073)
fix(network): make protocol cleanup reliable under dispatcher saturation

Resolves #3585.

Make Connection::close cleanup reliable when dispatcher immediate queues are saturated.

Before this change, Connection::close ignored the boolean returned by Dispatcher::addEvent and submitted Protocol::release with a 30-second expiration. Under sustained dispatcher backlog, the cleanup callback could be rejected at admission or expire before execution. That could leave ProtocolGame attached to its player longer than intended, pushing the eventual cleanup into the regular ping-timeout path and making the delay appear in Game::checkCreatures telemetry.

Main changes:
- Remove the expiration from Protocol::release dispatch.
- Try ProtocolInput first for protocol cleanup.
- Fall back to WorldCommit when ProtocolInput rejects admission.
- Retain the closing connection and retry after 50 ms when both dispatcher lanes reject admission.
- Keep at most one retry timer per closing connection.
- Treat dispatcher shutdown as terminal and avoid rearming the I/O retry in that case.
- Rate-limit the dispatcher saturation warning globally to once every 5 seconds.
- Keep all protocol and player ownership mutation on the dispatcher thread.

Behavior:
- Closing connections now retain ownership until a non-expiring protocol-release callback is accepted by a dispatcher lane.
- Saturation is reported without flooding logs.
- Normal disconnected-player reconnect window remains unchanged.
- Existing 60-second forced logout behavior remains unchanged.

Tests:
- Add unit coverage for boolean fallback-lane admission.
- Add unit coverage for terminal dispatcher shutdown classification.
- Run git diff --check.
- Verify the changed C++ ranges against the repository clang-format configuration.
- Local build and executable unit tests were not run; GitHub Actions provides executable validation for this PR.

Documentation:
- Update performance and lifetime documentation with reliable network-close cleanup requirements.

This prevents protocol cleanup from being silently dropped or expired during dispatcher backlog while preserving dispatcher ownership and existing disconnect behavior.
2026-08-12 16:03:36 -03:00
..
livestream feat: add livestream broadcasting system (#3965) 2026-05-22 16:53:29 -03:00
performance-lifetime fix(network): retry rejected protocol cleanup (#4073) 2026-08-12 16:03:36 -03:00
client-15-25-compatibility-update.md feat: update current client 15.25 compatibility (#4020) 2026-07-06 20:42:40 -03:00
content-reference-auditor.md fix(audit): repair invalid item ranges and reduce storage false positives (#4034) 2026-07-13 22:02:47 -03:00
expert-pvp-implementation-roadmap.md feat(pvp): add Expert PvP world type and combat rules (#4033) 2026-08-10 18:42:55 -03:00
expert-pvp-porting-plan.md feat(pvp): add Expert PvP world type and combat rules (#4033) 2026-08-10 18:42:55 -03:00
lua-api-docgen.md feat: add Lua API documentation and doc generator (#3771) 2026-05-25 14:39:39 -03:00
lua-shared-userdata.md perf(lua): harden shared userdata and reduce refcount churn (#3987) 2026-05-28 16:16:27 -03:00
multiprotocol.md feat: update current client 15.25 compatibility (#4020) 2026-07-06 20:42:40 -03:00
README.md feat(pvp): add Expert PvP world type and combat rules (#4033) 2026-08-10 18:42:55 -03:00
weapon-proficiency.md feat: protocol 15.11 (weapon proficiency and new imbuement scroll) (#3845) 2026-05-21 14:34:39 -03:00