Skip to content

Minor : Use specific error in compression catch handle #20144

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

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from

Conversation

k-raina
Copy link
Contributor

@k-raina k-raina commented Jul 10, 2025

Instead of throwable, use specific error in compression catch handle

@github-actions github-actions bot added triage PRs from the community core Kafka Broker clients small Small PRs labels Jul 10, 2025
Copy link
Member

@chia7712 chia7712 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@k-raina thanks for this patch. I have a suggestion for you.

@@ -717,7 +718,7 @@ private Optional<Builder<?>> createPushRequest(ClientTelemetrySubscription local
ByteBuffer compressedPayload;
try {
compressedPayload = ClientTelemetryUtils.compress(payload, compressionType);
} catch (Throwable e) {
} catch (IOException | NoClassDefFoundError e) {
log.debug("Failed to compress telemetry payload for compression: {}, sending uncompressed data", compressionType);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps the log could include the exception?

Copy link
Contributor

@apoorvmittal10 apoorvmittal10 Jul 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the compressionType in the next call i.e. once NoClassDefFoundError error is encountered then it will happen for every push hence do we want to try other compression types as supported by broker or move to compression type none for next push?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chia7712 Addressed in comment 7f258c8

@apoorvmittal10
That makes sense! Can this functionality be added in seperate PR?

Copy link
Contributor

@apoorvmittal10 apoorvmittal10 Jul 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there is any value in having a separete PR and we can't achieve the right way in this PR itself, we should create a jira and fix it. Else if there is something else for which you need this PR to go early then it's different, and I guess there is nothing as this new behaviour will anyways go in 4.2.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@apoorvmittal10
We need to merge this PR first, to fix this workaround for users which are facing this problem in older versions of connect and schema registry jars .

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@k-raina catching the Throwable is not a major issue, so there is no hurry to include it in the 4.1.0 release. Perhaps you could address @apoorvmittal10 comment in this PR, and then we could backport it to 4.1.1

Copy link
Contributor

@apoorvmittal10 apoorvmittal10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the the patch. Can we pelase add test cases for the PR as well.

@@ -717,7 +718,7 @@ private Optional<Builder<?>> createPushRequest(ClientTelemetrySubscription local
ByteBuffer compressedPayload;
try {
compressedPayload = ClientTelemetryUtils.compress(payload, compressionType);
} catch (Throwable e) {
} catch (IOException | NoClassDefFoundError e) {
log.debug("Failed to compress telemetry payload for compression: {}, sending uncompressed data", compressionType);
Copy link
Contributor

@apoorvmittal10 apoorvmittal10 Jul 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the compressionType in the next call i.e. once NoClassDefFoundError error is encountered then it will happen for every push hence do we want to try other compression types as supported by broker or move to compression type none for next push?

@github-actions github-actions bot removed the triage PRs from the community label Jul 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clients core Kafka Broker small Small PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants