[Docs]: Document finally cleanup behavior during durable suspension
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- java
- Domain
- documentation
Research direction
Start in docs/advanced/error-handling.md at the “Handling SuspendExecutionException” section and review the linked shared documentation request for context. Document how finally behaves during suspension, explain safe cleanup placement and exception propagation, and include the proposed Java example; the section is done when it covers both normal suspension and terminal cleanup paths.
Written by the indexing model from the issue text.
Description
Issue
The Handling SuspendExecutionException section correctly explains that SuspendExecutionException extends Error, bypasses a normal catch (Exception e), and must never be swallowed.
It does not currently explain the related finally behavior: Java executes an active finally block while SuspendExecutionException unwinds the stack. As a result, resource cleanup placed in finally can run during a normal durable suspension rather than only when the overall durable execution succeeds or fails.
This applies to any operation that can suspend, including wait, waitForCondition, callbacks, invokes, retry delays, and suspension inside map or parallel branches.
For example, this pattern can terminate a resource immediately when the wait suspends:
try {
var resource = ctx.step("launch-resource", Resource.class,
stepCtx -> launchResource());
var result = ctx.waitForCallback("work-complete", Result.class,
(callbackId, stepCtx) -> dispatchWork(resource, callbackId));
return result;
} finally {
ctx.step("terminate-resource", Void.class,
stepCtx -> terminateResource());
}
Page/Location
https://github.com/aws/aws-durable-execution-sdk-java/blob/main/docs/advanced/error-handling.md
Section: Handling SuspendExecutionException
Suggested Fix
Extend the section with guidance that:
finallyexecutes when the internal suspension signal unwinds the handler stack.- Durable cleanup that must happen only on completion or actual failure should not be placed in
finallyaround suspending operations. - Cleanup should run explicitly after successful completion and from handlers for application or operation exceptions.
SuspendExecutionExceptionmust continue to propagate untouched; avoidcatch (Throwable)unless it immediately rethrows suspension and other control-flow errors appropriately.
Include a safe Java example such as:
try {
var result = performDurableWorkThatMaySuspend(ctx);
ctx.step("cleanup-resource", Void.class,
stepCtx -> cleanupResource());
return result;
} catch (Exception e) {
ctx.step("cleanup-resource", Void.class,
stepCtx -> cleanupResource());
throw e;
}
The cleanup step occupies the same next durable-operation position on either terminal path, while SuspendExecutionException bypasses catch (Exception e) and suspends normally.
This is the Java-specific companion to the shared documentation request: https://github.com/aws/aws-durable-execution-docs/issues/131.
- Dominant language
- Java
- Stars
- 28
- Forks
- 13
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 44
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing 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.
More from aws/aws-durable-execution-sdk-java
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
aws/aws-durable-execution-sdk-java#300 ·
Maintainers usually reply within 1 day
-
enhancement needs-triage
Difficulty 5/5 Over a week Newbie friendliness 35/100
aws/aws-durable-execution-sdk-java#779 ·
Maintainers usually reply within 1 day
-
[Bug]: root handler instrumentation misses the canonical OTel execution contextPossibly taken A pull request linked to this issue is open or already merged. Openneeds-triage
Difficulty 5/5 Over a week Newbie friendliness 40/100
aws/aws-durable-execution-sdk-java#770 ·
Maintainers usually reply within 1 day
-
[Feature]: Propagate per-operation trace context for chained invokesPossibly taken A pull request linked to this issue is open or already merged. Openenhancement needs-triage
Difficulty 5/5 Over a week Newbie friendliness 38/100
aws/aws-durable-execution-sdk-java#764 ·
Maintainers usually reply within 1 day
-
bug needs-triage
Difficulty 4/5 3-5 days Newbie friendliness 35/100
aws/aws-durable-execution-sdk-java#763 ·
Maintainers usually reply within 1 day
All issues in aws/aws-durable-execution-sdk-java
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
jenkinsci/gitlab-plugin#1950 ·
-
It's not necessary to copy the memory block in the readWrite() of org.h2.store.fs.mem.FileMemDataOpen
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
h2database/h2database#4435 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
micronaut-projects/micronaut-core#13717 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ADORSYS-GIS/token-status-link#145 ·
Maintainers usually reply within 3 days
-
enhancement
Difficulty 1/5 Under an hour Newbie friendliness 88/100
helidon-io/helidon#12721 ·
Maintainers usually reply within 1 day