Skip to content

Fix potential NPE in ApiCallAttemptTimeoutTrackingStage #6332

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

Merged
merged 3 commits into from
Aug 18, 2025

Conversation

L-Applin
Copy link
Contributor

fix potential NullPointerException in ApiCallAttemptTimeoutTrackingStage when exception is thrown before the tracker can be set in the context

Motivation and Context

Customer reported NPE because the call to context.apiCallAttemptTimeoutTracker() returns null. There is some code that could throw an exception before the timeoutTracker is set on the context, particularly if the ScheduledExecutorService rejects the scheduled task for some reason.

Modifications

Added null check

Testing

ran unit tests

…age when exception is thrown before the tracker can be set in the context
@L-Applin L-Applin requested a review from a team as a code owner August 12, 2025 16:48
Copy link
Contributor

@zoewangg zoewangg left a comment

Choose a reason for hiding this comment

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

This seems to only fix the symptom, not the root cause, can we create a task to fix the root cause?

@L-Applin
Copy link
Contributor Author

This seems to only fix the symptom, not the root cause, can we create a task to fix the root cause?

There is always a risk of this happening, I believe the root cause is when the timeout task is rejected by the SCHEDULED_EXECUTOR_SERVICE. The timeSyncTaskIfNeeded will throw an exception before the the timeout tracker is added to the context via context.apiCallAttemptTimeoutTracker(timeoutTracker).

Copy link

@L-Applin L-Applin added this pull request to the merge queue Aug 18, 2025
Merged via the queue into master with commit 09a4b8f Aug 18, 2025
38 of 42 checks passed
Copy link

This pull request has been closed and the conversation has been locked. Comments on closed PRs are hard for our team to see. If you need more assistance, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants