-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FIXED] Subscription interest could remain after slow consumer error #5754
Conversation
When a slow consumer error is detected, the server will close the connection. In some race situations, it could be that the subscription interest is left intact, which would cause routed servers to continue routing messages although the interest should have been gone. The subscription could still be seen in the monitoring subscriptions list (when displaying with details), referencing a client connection that would be in the closed connection state. The monitoring route page of the other servers would still indicate that there is interest for this subject on the origin server. Resolves #5539 Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general LGTM - question about avoiding a copy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, good spot!
This avoids the alloc and copy and still allows the connection to be properly released. Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
@@ -5511,6 +5513,14 @@ func (c *client) closeConnection(reason ClosedState) { | |||
} | |||
} | |||
|
|||
// Now that we are done with subscriptions, clear the field so that the | |||
// connection can be released and gc'ed. | |||
if kind == CLIENT || kind == LEAF { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI when we set this to nil in saveClosedClient it was a much broader set of connection types. Do we think this might cause any GC issues on non client/leaf connections?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No because we invoked saveClosedClient() only for CLIENT and LEAF:
Line 1828 in 02bd284
if c.kind == CLIENT || c.kind == LEAF { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry was just looking at the internal if..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
When a slow consumer error is detected, the server will close the connection. In some race situations, it could be that the subscription interest is left intact, which would cause routed servers to continue routing messages although the interest should have been gone.
The subscription could still be seen in the monitoring subscriptions list (when displaying with details), referencing a client connection that would be in the closed connection state.
The monitoring route page of the other servers would still indicate that there is interest for this subject on the origin server.
Resolves #5539
Signed-off-by: Ivan Kozlovic ivan@synadia.com