Description
Describe the bug
The clean-up of a stream connection state when a stream member goes down can remove subscriptions not affected by the member. The subscription state is removed from the connection, but the subscription is not removed from the SAC state (if the subscription is a SAC), because the subscription member PID does not match the down member PID.
When the actual member of the subscription goes down, the subscription is no longer part of the state, so the clean-up does not find the subscription and does not remove it from the SAC state. This lets a ghost consumer in the corresponding SAC group.
This can be reproduced by starting a 3-node cluster, registering some consumers, e.g.:
stream-perf-test --producers 0 --consumers 2 --single-active-consumer --consumer-names app1 --uris rabbitmq-stream://localhost:5552,rabbitmq-stream://localhost:5553,rabbitmq-stream://localhost:5554
Restarting the stream, then listing the consumers for the group. It can take several times to reproduce, but there will more than 2 consumers in the group at some point.