Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[Docs]: Document finally cleanup behavior during durable suspension

未关闭 适合新手
#645 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
1/5
预计耗时
1-3 小时
新手友好度
88/100
Issue 类型
文档
描述清晰度
描述清楚
活跃度
活跃
技术栈
java
领域
documentation

调研方向

从 docs/advanced/error-handling.md 中的“Handling SuspendExecutionException”部分开始,并查看链接的共享文档请求以了解上下文。记录 finally 在暂停期间的行为,说明安全放置清理操作的位置以及异常传播方式,并包含提议的 Java 示例;当该部分同时涵盖正常暂停和终止清理路径时,即可完成。

由索引模型根据 Issue 内容生成。

描述

documentation pkg:sdk

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:

  • finally executes 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 finally around suspending operations.
  • Cleanup should run explicitly after successful completion and from handlers for application or operation exceptions.
  • SuspendExecutionException must continue to propagate untouched; avoid catch (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.

主要语言
Java
星标
28
派生
14
平均合并
2 天 19 小时
30 天内合并 PR
43

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

aws/aws-durable-execution-sdk-java 的其他 Issue

查看 aws/aws-durable-execution-sdk-java 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。