Skip to content
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

Subscription removed from StompClientConnectionImpl cache even before sending UNSUBSCRIBE frame #92

Open
saiskk opened this issue Jan 10, 2024 · 2 comments
Labels

Comments

@saiskk
Copy link

saiskk commented Jan 10, 2024

Questions

Do not use this issue tracker to ask questions, instead use one of these channels. Questions will likely be closed without notice.

Version

Which version(s) did you encounter this bug ?
4.4.5

Context

In StompClientConnectionImpl class when an unsubscribe call is received, it is removed from client cache "List subscriptions" before sending the UNSUBSCRIBE frame. When this call is failed at server side, client cache doesn't have the subscription due to which we are receiving events and we cannot make another unsubscribe call as StompClientConnectionImpl would return an IllegalArgumentException

if (maybeSubscription.isPresent()) {
final Subscription subscription = maybeSubscription.get();
subscriptions.remove(subscription);
send(new Frame(Command.UNSUBSCRIBE, headers, null), receiptHandler);
return this;

Same goes for subscribe as well.

subscriptions.add(new Subscription(destination, id, handler));
headers.put(Frame.DESTINATION, destination);
if (!headers.containsKey(Frame.ID)) {
headers.put(Frame.ID, id);
}
Frame frame = new Frame(Command.SUBSCRIBE, headers, null);
send(frame, ar -> {
if (receiptHandler != null) {
receiptHandler.handle(ar.map(id));
}
});

@saiskk saiskk added the bug label Jan 10, 2024
@vietj
Copy link
Contributor

vietj commented Jan 10, 2024

do you have a reproducer for this ?

@saiskk
Copy link
Author

saiskk commented Jan 10, 2024

Nope I'll try to create a test case for it. Fix would be adding the subscription in cache after sending SUBSCRIBE/UNSUBSCRIBE frame, so haven't thought of reproducer.

@saiskk saiskk closed this as completed Jan 10, 2024
@saiskk saiskk reopened this Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants