Skip to content

Dangling NATS Consumer Causes Client Not to Receive Result Event After Abnormal Exit #65

@anhthii

Description

@anhthii

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 info showed:
    • Waiting Pulls: 3 of maximum 512
    • Unprocessed Messages: 0
  • No result was delivered to the new client instance.

After running:

nats consumer rm mpc mpc_keygen_result

Suggestions

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions