From: Matteo Nastasi Date: Sun, 13 Sep 2026 10:38:08 +0000 (+0200) Subject: message queue per user tripled, and the ceiling that holds it X-Git-Url: https://mop.ddnsfree.com/gitweb/?a=commitdiff_plain;h=dd9f45d1c7ac1162900bd50d96f2e71c7537880b;p=brisk.git message queue per user tripled, and the ceiling that holds it If the client falls behind by more than COMM_N messages the history is lost: it is sent back to the initial page, splash included. That happens when it reconnects after a burst, for instance while the garbage collector removes dozens of disconnected users at once and every removal produces a room update. Eighteen messages are few, but they could not be raised on their own: every queued update carries the complete list of the people present (standup_content), which with a full room is about 3 KB, and eighteen of those were already 61 KB against the 65536 of SHM_DIMS_U_MAX. Raising COMM_N without raising the ceiling would have made shm_put_var fail. The segments grow by SHM_DIMS_U_DLT at a time, so whoever does not fill the queue pays nothing. WARNING: changing COMM_N means the queue indexes (step % COMM_N) no longer match those the users were saved with. The persisted state has to be wiped: without that, the tables stay in "sitreser" and never form again. Verified in the field, in both directions. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_014M1jiEq9cHdE5SE5j6vFuE --- diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh index d6165db..08c5808 100644 --- a/web/Obj/brisk.phh +++ b/web/Obj/brisk.phh @@ -39,10 +39,23 @@ define('SHM_DIMS_MAX', SHM_DIMS_MIN + 1048576); define('SHM_DIMS_DLT', 65536); define('SHM_DIMS_U_MIN', 4096); -define('SHM_DIMS_U_MAX', 65536); +/* Ceiling of the shared memory per user. It has to stay generous with + respect to COMM_N: every queued room update carries the complete list of + the people present (see standup_content), which with a full room is of the + order of 3 KB. With COMM_N at 54 a full queue is about 180 KB, and the old + 64 KB would have made shm_put_var fail. The segments grow by + SHM_DIMS_U_DLT at a time, so whoever does not fill the queue pays + nothing. */ +define('SHM_DIMS_U_MAX', 262144); define('SHM_DIMS_U_DLT', 4096); -define('COMM_N', 18); +/* Length of the message queue per user. If the client falls behind by more + than COMM_N messages the history is lost and it is sent back to the initial + page, splash included: that happens in bursts, for instance when the + garbage collector removes dozens of disconnected users at once and every + removal produces a room update. Raised from 18 to 54; see the + SHM_DIMS_U_MAX ceiling above, which has to grow together with this. */ +define('COMM_N', 54); define('COMM_GEN_N', 50); define('CHAT_N', 3);