fix(lludp): prevent idle-region incoming packet watchdog false alarms (#114)

* fix(lludp): refresh incoming packet watchdog while region is idle

* test(lludp): guard against idle-watchdog regression

* ci(lludp): check idle polling cannot outlast watchdog deadline
This commit is contained in:
OpenGenesis (MPL 2.0) authored and GitHub committed 2026-10-09 17:30:44 +02:00
1 parent 4c087091be
commit a44d13179d
3 files changed
+44 -1

No files matched your search

+4
View File
@@ -294,6 +294,10 @@ jobs:
shell: bash
run: python3 tools/ci/verify_avatar_appearance_config.py
- name: Verify LLUDP incoming idle watchdog heartbeat
shell: bash
run: python3 tools/ci/verify_lludp_incoming_watchdog.py
- name: Verify Firestorm bridge bootstrap compatibility
shell: bash
run: python3 tools/ci/verify_firestorm_bridge_bootstrap.py
@@ -1777,7 +1777,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
Scene.ThreadAlive(1);
try
{
if (packetInbox.TryTake(out IncomingPacket incomingPacket, 4500) && IsRunningInbound)
// Poll frequently enough to refresh the watchdog during a quiet region.
// Waiting 4500ms against a 5000ms watchdog deadline left too little
// margin for scheduling/GC pauses and caused false timeout alarms.
if (packetInbox.TryTake(out IncomingPacket incomingPacket, 1000) && IsRunningInbound)
{
if (incomingPacket.Client.IsActive)
{
@@ -0,0 +1,36 @@
#!/usr/bin/env python3
"""Guard against false LLUDP watchdog warnings while regions are idle."""
from pathlib import Path
import re
ROOT = Path(__file__).resolve().parents[2]
udp = (ROOT / "OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs").read_text(encoding="utf-8")
watchdog = (ROOT / "OpenSim/Framework/Monitoring/Watchdog.cs").read_text(encoding="utf-8")
timeout_match = re.search(r"DEFAULT_WATCHDOG_TIMEOUT_MS\s*=\s*(\d+)", watchdog)
assert timeout_match, "Watchdog timeout constant not found"
timeout_ms = int(timeout_match.group(1))
start = udp.index("protected void IncomingPacketHandler()")
end = udp.index("protected void OutgoingPacketHandler()", start)
handler = udp[start:end]
poll_match = re.search(
r"packetInbox\.TryTake\(out IncomingPacket incomingPacket,\s*(\d+)\)", handler
)
assert poll_match, "Expected incoming-packet idle poll was changed or removed"
poll_ms = int(poll_match.group(1))
assert 0 < poll_ms <= timeout_ms // 4, (
f"Idle packet poll ({poll_ms}ms) must be far below watchdog threshold ({timeout_ms}ms)"
)
assert "incomingPacket.Client.ProcessInPacket(incomingPacket.Packet)" in handler, (
"Incoming packet processing must remain intact"
)
assert "Watchdog.UpdateThread();" in handler, (
"The incoming thread must report its heartbeat after polling and processing"
)
assert 'IncomingPacketHandler,\n $"Incoming Packets ({Scene.Name})"' in udp, (
"Incoming packet worker must remain monitored by the watchdog"
)
print(f"LLUDP idle watchdog safety: OK ({poll_ms}ms idle poll, {timeout_ms}ms timeout)")