{"record":{"id":"08b1c6b596842642","repo":"RocketChat/Rocket.Chat","slug":"message-delivery-high-delay-detected-received","errorCode":null,"errorMessage":"[Message Delivery] High delay detected: ${receiveDelay}ms. Possible network or backend issue.","messagePattern":"\\[Message Delivery\\] High delay detected: (.+?)ms\\. Possible network or backend issue\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"apps/meteor/app/ui-utils/client/lib/LegacyRoomManager.ts","lineNumber":187,"sourceCode":"\tstreams.push(\n\t\t...[\n\t\t\tsdk.stream('room-messages', [record.rid], async (msg) => {\n\t\t\t\t// Should not send message to room if room has not loaded all the current messages\n\t\t\t\t// if (RoomHistoryManager.hasMoreNext(record.rid) !== false) {\n\t\t\t\t// \treturn;\n\t\t\t\t// }\n\t\t\t\t// Do not load command messages into channel\n\t\t\t\tif (msg.t !== 'command') {\n\t\t\t\t\tconst subscription = Subscriptions.state.find(({ rid }) => rid === record.rid);\n\t\t\t\t\tconst isNew = !Messages.state.find((record) => record._id === msg._id && record.temp !== true);\n\n\t\t\t\t\t// Measure and log message receive delay for messages\n\t\t\t\t\tif (msg.ts) {\n\t\t\t\t\t\tconst receiveDelay = Date.now() - new Date(msg.ts).getTime();\n\n\t\t\t\t\t\t// Log warning if delay is significant (>2 seconds)\n\t\t\t\t\t\tif (receiveDelay > 2000) {\n\t\t\t\t\t\t\tconsole.warn(`[Message Delivery] High delay detected: ${receiveDelay}ms. Possible network or backend issue.`);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tawait upsertMessage({ msg, subscription });\n\t\t\t\t\tif (isNew) {\n\t\t\t\t\t\tawait clientCallbacks.run('streamNewMessage', msg);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tawait clientCallbacks.run('streamMessage', { ...msg, name: room.name || '' });\n\n\t\t\t\tfireGlobalEvent('new-message', {\n\t\t\t\t\t...msg,\n\t\t\t\t\tname: room.name || '',\n\t\t\t\t\troom: {\n\t\t\t\t\t\ttype,\n\t\t\t\t\t\tname,\n\t\t\t\t\t},","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/app/ui-utils/client/lib/LegacyRoomManager.ts#L169-L205","documentation":"Diagnostic console.warn from LegacyRoomManager while processing realtime streamMessage events on the client. For each incoming message it compares the message's server timestamp (msg.ts) with the browser clock (Date.now()) and warns when the difference exceeds 2 seconds. It flags slow delivery (network or backend), but client clock skew produces the same warning even when delivery was instant.","triggerScenarios":"A DDP stream message arrives with Date.now() - new Date(msg.ts).getTime() > 2000: after reconnect when queued messages are flushed, during server overload or slow MongoDB writes, or simply because the client clock is off (VMs, dual-boot, drifted NTP). Only non-command messages with msg.ts are measured.","commonSituations":"Laptop sleeping and resuming with queued realtime messages; workstations with unsynchronized clocks; server restart processing backlog; large message bursts during load tests; slow networks or websocket reconnect storms.","solutions":["Compare the browser clock against the server clock first - clock skew is the most common cause and makes the warning a false positive","If clocks agree and the warn repeats across many clients, inspect server-side latency: MongoDB slow queries, server load, DDP queue depth","Ignore isolated occurrences after sleep/reconnect; queued messages legitimately measure as delayed","Correlate with server logs at the same timestamps to check whether publication was actually late"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Only trust the delay metric after accounting for clock offset\nconst clockOffset = estimateClockOffsetMs(); // e.g. from a server time endpoint\nconst receiveDelay = Date.now() - clockOffset - new Date(msg.ts).getTime();\nconst clockIsTrustworthy = Math.abs(clockOffset) < 5_000;\nif (clockIsTrustworthy && receiveDelay > 2_000) {\n  console.warn(`[Message Delivery] High delay detected: ${receiveDelay}ms`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep client machines NTP-synced; treat clock skew above a few seconds as measurement noise","Do not alert on a single warn line - aggregate across users before blaming the backend","Build latency dashboards from server-side timestamps rather than client clocks"],"tags":["realtime","ddp","latency","clock-skew","client","diagnostics"],"backgroundTag":"message-delivery-latency","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}