temporalio / temporalio/sdk-java
Sync versions of GrpcRetryer should throw InterruptedException
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 433
- Forks
- 249
- Avg merge
- 5d 6h
- Merged PRs (30d)
- 26
Description
GrpcRetryer retry method by its nature is expected to throw InterruptedException because they
- perform waiting on a timer
- could get an Interrupted flag from GRPC calls with a StatusRuntimeException exception with CANCELLED status
Now handling of InterruptedExceptions is brittle:
- we hide the Interrupted exceptions from the timer and we raise an Interrupted flag instead.
- We consider StatusRuntimeException with CANCELLED from GRPC as non-retryable.
So, code that uses GrpcRetryer should expect a non-Interrupted Exception + Interrupted flag if interruption happens.
There is nothing wrong with the model per se if the users are very aware of the potential interrupted flag and process it correctly.
But to make code more idiomatic and enforce the correct handling of InterruptedException and awareness of its possibility inside GrpcRetryer, we should change GrpcRetryer methods to throw explicit InterruptedExceptions.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the GrpcRetryer retry methods and trace their callers to understand how timer interruptions, interrupted flags, and CANCELLED StatusRuntimeExceptions are handled. Change the methods to expose InterruptedException explicitly, then verify that callers and existing behavior reflect the intended interruption model.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- grpc, java
- Domain
- backend-api-design
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100