mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-10-30 02:08:42 -04:00
When a monitor's zms exits, the status poll gets reason=no_socket and the stream is reloaded under a new connkey. A no_socket reply takes over a second (stream.php waits for the socket file to appear) while the poll runs every second, and every request on the page shares one ajaxQueue, so a second poll for the dead connkey is usually already queued when the first reply arrives. Its reply then reloaded the stream again: it sent CMD_QUIT to the zms the first reload had just started and replaced the connkey a second time. Each restart of an unreachable monitor therefore left an orphaned zms behind, and a poll queued for that orphan between the two reloads could find it shutting down. stream.php then waited the full MSG_TIMEOUT and logged "Timed out waiting for msg ... after waiting 5000 milliseconds", while every other monitor's poll on the page waited behind it in the shared queue. Bind each reply to the connkey its request was sent with and drop replies for a connkey we no longer hold, as EventStream already does. alarmCommand() passes its connkey explicitly, since binding getStreamCmdResponse directly would hand it jQuery's textStatus in that argument. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>