Skip to content

MINOR: Improve error logging for task commit failures #19326

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

Conversation

bbejeck
Copy link
Member

@bbejeck bbejeck commented Mar 31, 2025

Enhances the error messages logged during task commit failures by including the specific cause from the TimeoutException. This provides clearer context to debug issues related to timeout errors.

While we provide the exception object to the log.error method, if a user removes stack traces from the logging, then we are left with the message Committing failed. By adding the Exception.getMessage() we'll gain a little more insight in these instances.

All existing tests passed locally

Enhances the error messages logged during task commit failures by including the specific cause from the `TimeoutException`. This provides clearer context to debug issues related to timeout errors.
@github-actions github-actions bot added streams small Small PRs labels Mar 31, 2025
Copy link
Member

@lucasbru lucasbru left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

offsetsPerTask
.keySet()
.stream()
.map(t -> t.id().toString())
.collect(Collectors.joining(", "))),
.collect(Collectors.joining(", ")), timeoutException.getMessage()),
timeoutException
Copy link
Member

@mjsax mjsax Mar 31, 2025

Choose a reason for hiding this comment

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

Not sure if I understand this change. Given that we pass timeoutException as second parameter into log.error(...) we should get the corresponding error message logged already?

if a user removes stack traces from the logging,

Not sure what this means?

Copy link
Member

Choose a reason for hiding this comment

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

Nit: formatting:

log.error(
    String.format(
        "Committing task(s) %s failed due to %s",
        offsetsPerTask
            .keySet()
            .stream()
            .map(t -> t.id().toString())
            .collect(Collectors.joining(", ")),
        timeoutException.getMessage()
    ),
    timeoutException
);
timeoutException

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, we pass timeoutException but If users truncate the stack trace that information is lost

@bbejeck bbejeck closed this Apr 1, 2025
@bbejeck bbejeck deleted the MINOR_add_error_message_for_timeout_exceptions branch April 1, 2025 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants