# org.jenkinsci.plugins.workflow.steps.FlowInterruptedException：流水线在 60 分钟后超时

- **ID:** `cicd/jenkins-pipeline-timeout`
- **领域:** cicd
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 90%

## 根因

Jenkins 流水线阶段或整个流水线超过了配置的超时限制，导致构建被中止。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Jenkins 2.346+ | active | — | — |
| Pipeline: Declarative 1.8.5+ | active | — | — |
| Pipeline: Groovy 2.9+ | active | — | — |

## 解决方案

1. ```
   Increase the timeout in the Jenkinsfile by modifying the `options` block: `options { timeout(time: 120, unit: 'MINUTES') }` for the entire pipeline, or add `timeout(time: 30, unit: 'MINUTES')` to a specific stage.
   ```
2. ```
   Optimize the pipeline to reduce execution time by parallelizing stages with `parallel` directive: `stage('Build and Test') { parallel { stage('Build') { ... } stage('Test') { ... } } }`
   ```

## 无效尝试

- **Removing the timeout option entirely from the Jenkinsfile** — Without a timeout, the pipeline can run indefinitely, consuming resources and potentially blocking the executor queue. (30% 失败率)
- **Setting the timeout to a very high value (e.g., 9999 minutes) to avoid the error** — This masks the underlying issue (e.g., a stuck step or resource contention) and can lead to resource exhaustion. (50% 失败率)
