Skip to content

bus: log a redis queue lock that fails instead of dropping it silently - #156

Open
cosmin-staicu wants to merge 1 commit into
livekit:mainfrom
UiPath:fix/redis-queue-lock-error-log
Open

cosmin-staicu wants to merge 1 commit into
livekit:mainfrom
UiPath:fix/redis-queue-lock-error-log

Conversation

@cosmin-staicu

Copy link
Copy Markdown

A queue subscription picks the receiver for a message with a SET NX lock on the payload hash. When that command fails, read() skips the message exactly as it does when another receiver won the lock, and logs nothing. A queue RPC whose only server hit an error there is lost without a trace, and the client sees "no response from servers".

The error is now logged before the message is skipped, unless the subscription is closing. Losing the lock to another receiver is the normal case and stays silent. The message is still not retried: go-redis already retries connection errors, and after an ambiguous reply this receiver can't tell whether it holds the lock.

The psrpc logger is a global that running bus goroutines read, so the tests install a recording logger once in TestMain. A go-redis hook fails SET on demand. The tests check that a failed lock is logged once and the next message is still delivered, and that a lock lost to a second receiver logs nothing.

A queue subscription decides which receiver handles a message with a SET NX
lock on the payload hash. When that command failed, read() skipped the
message exactly as it does when another receiver won the lock, with nothing
logged. A queue RPC whose only server hit an error there was lost without a
trace, and the client saw "no response from servers".

Log the error before skipping the message, unless the subscription is closing.
Losing the lock to another receiver is the normal outcome and stays silent.
The message is still not retried: go-redis already retries connection errors,
and after an ambiguous reply this receiver cannot tell whether it holds the
lock.

The tests install a recording logger once for the package, since the psrpc
logger is a global that running bus goroutines read, and use a go-redis hook
to fail SET on demand: a failed lock is logged once and the next message is
delivered, and a lock lost to a second receiver logs nothing.

Signed-off-by: Cosmin Staicu <cosmin.staicu@uipath.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant