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

The consumer clients created by the Proxy using the WebSocket protocol may cause request blocking. #21839

Closed
2 tasks done
zifengmo opened this issue Jan 3, 2024 · 3 comments · Fixed by #22164
Closed
2 tasks done
Assignees
Labels
type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages

Comments

@zifengmo
Copy link
Contributor

zifengmo commented Jan 3, 2024

Search before asking

  • I searched in the issues and found nothing similar.

Motivation

In our usage scenario, the ability to create subscriptions directly through the consumer client has been disabled.
This leads to a problem where the Proxy creates consumer clients for consuming topics via WebSocket. In certain exceptional cases, these clients will keep retrying to connect to the broker, such as when encountering a SubscriptionNotFoundException ("Subscription does not exist"). However, this exception is considered retryable, causing the Proxy to continuously attempt to connect to the broker for subscription.
Because this exception leads to retries and bypasses the consumer quantity verification, it causes the Proxy to continuously retry the subscription, blocking normal requests.
Therefore, it is desired to have special handling for consumer clients created through the Proxy, or to subtract something specific for retryable exceptions, in order to avoid situations like the one mentioned above where such exceptions trigger retries in the Proxy.

Code Example:
public static boolean isRetriableError(Throwable t) {
if (t instanceof AuthorizationException
|| t instanceof InvalidServiceURL
|| t instanceof InvalidConfigurationException
|| t instanceof NotFoundException
|| t instanceof IncompatibleSchemaException
|| t instanceof TopicDoesNotExistException
|| t instanceof UnsupportedAuthenticationException
|| t instanceof InvalidMessageException
|| t instanceof InvalidTopicNameException
|| t instanceof NotSupportedException
|| t instanceof NotAllowedException
|| t instanceof ChecksumException
|| t instanceof CryptoException
|| t instanceof ConsumerAssignException
|| t instanceof MessageAcknowledgeException
|| t instanceof TransactionConflictException
|| t instanceof ProducerBusyException
|| t instanceof ConsumerBusyException
|| t instanceof TransactionHasOperationFailedException) {
return false;
}
return true;
}

Solution

No response

Alternatives

No response

Anything else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!
@zifengmo zifengmo added the type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages label Jan 3, 2024
@poorbarcode
Copy link
Contributor

@zifengmo Make sense. Could you push a PR to improve this behavior?

@zifengmo
Copy link
Contributor Author

I fixed it this way and re-packaged the jar, placing it in the lib directory for starting the proxy service.
public static boolean isRetriableError(Throwable t) { if (t instanceof AuthorizationException || t instanceof InvalidServiceURL || t instanceof InvalidConfigurationException || t instanceof NotFoundException || t instanceof IncompatibleSchemaException || t instanceof TopicDoesNotExistException || t instanceof UnsupportedAuthenticationException || t instanceof InvalidMessageException || t instanceof InvalidTopicNameException || t instanceof NotSupportedException || t instanceof NotAllowedException || t instanceof ChecksumException || t instanceof CryptoException || t instanceof ConsumerAssignException || t instanceof MessageAcknowledgeException || t instanceof TransactionConflictException || t instanceof ProducerBusyException || t instanceof ConsumerBusyException || t instanceof TransactionHasOperationFailedException) { return false; } if (t.getMessage() != null && t.getMessage().contains("Subscription does not exist")) { return false; } return true; }

@zifengmo
Copy link
Contributor Author

@poorbarcode pr is here #22078

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages
Projects
None yet
2 participants