-
Notifications
You must be signed in to change notification settings - Fork 25
Description
Dangling NATS Consumer Causes Client Not to Receive Result Event After Abnormal Exit
Description
When the mpcium-client sends an event (e.g., keygen request) to the MPCIUM cluster, it may fail to receive the corresponding result (e.g., mpc_keygen_result) if a previous session exited abnormally. This results in the NATS consumer (mpc_keygen_result) still showing Waiting Pulls: >0, even though the client is no longer running.
As a result, new instances of the client may not receive responses due to lingering/dangling pull requests.
Investigation
- Stream:
mpc - Consumer:
mpc_keygen_result nats consumer infoshowed:Waiting Pulls: 3 of maximum 512Unprocessed Messages: 0
- No result was delivered to the new client instance.
After running:
nats consumer rm mpc mpc_keygen_resultSuggestions
Documentation:
-
Add this as a "Troubleshooting" entry in the docs.
-
Explain how to check Waiting Pulls and clean up dangling consumers.
Code Improvements:
-
Auto-detect and clean up orphaned consumers on client start.
-
Consider using ephemeral consumers or appending a unique instance ID to the consumer name.
-
Implement a client shutdown hook to remove the consumer cleanly.