States.ExecutionFailed:状态机的执行超过了最大执行历史记录大小 25000 条
States.ExecutionFailed: The execution of state machine exceeded the maximum execution history size of 25000 entries
ID: aws/stepfunctions-state-machine-execution-limit-exceeded
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| Step Functions 2024-08-01 | active | — | — | — |
| AWS SDK v2 | active | — | — | — |
| Lambda 2023-11-01 | active | — | — | — |
根因分析
Step Functions 状态机执行生成了超过 25,000 条历史记录(例如,由于长时间运行的循环或大型输入/输出负载),超出了服务限制。
English
Step Functions state machine execution has generated more than 25,000 history entries (e.g., due to long-running loops or large input/output payloads), which exceeds the service limit.
官方文档
https://docs.aws.amazon.com/step-functions/latest/dg/limits.html解决方案
-
Refactor the state machine to use a nested workflow or a callback pattern to break long-running executions into smaller chunks. Example: Use a Map state with a max concurrency to process items in parallel, reducing the number of steps.
-
Reduce input/output payload sizes by filtering or truncating data between states. Use a Pass state with ResultPath to trim unnecessary fields.
-
Implement a loop with a counter and a maximum iteration limit to prevent infinite loops from generating too many history entries.
无效尝试
常见但无效的做法:
-
95% 失败
The 25,000 history entry limit is a hard limit that cannot be increased by AWS support.
-
50% 失败
This may reduce history entries but can make the state machine less maintainable and might not solve the root cause if loops are the issue.
-
80% 失败
The limit is on history entries, not time; increasing timeout does not reduce history entries.