You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "goutamadwant (via GitHub)" <gi...@apache.org> on 2026/09/26 00:31:51 UTC
[PR] [Fix][E2E] Always stop the Flink JobManager in E2E teardown [seatunnel]
goutamadwant opened a new pull request, #12481:
URL: https://github.com/apache/seatunnel/pull/12481
### Purpose of this pull request
`AbstractTestFlinkContainer#tearDown` runs `execInContainer("rm", "-rf", ...)` on the TaskManager
before it stops anything. If the TaskManager is not running, that call throws:
- `IllegalStateException: execInContainer can only be used while the Container is running` when
the TaskManager container never started (for example, its wait strategy timed out on a slow
runner);
- `ConflictException: Status 409 ... container ... is not running` when it started and then died.
`tearDown` then exits, and the JobManager is never stopped.
The leaked JobManager keeps the `jobmanager` network alias on the shared test network until the
test JVM exits. The next Flink test case starts a new JobManager under the same alias. Its
TaskManager can resolve `jobmanager` to the leaked one and register there. The new JobManager
then logs `Missing resources ... numberOfRequiredSlots=1` / `Current resources: (none)`, and the
job waits until the workflow timeout. A local `DatabendIT` run on Flink 1.18 hung exactly this way
after `testFakeToDatabend`'s TaskManager exited during startup.
This PR:
- skips the volume cleanup for a container that is not running;
- always runs every teardown step (TaskManager, JobManager, host mount directory), so a failure
in one of them no longer skips the others;
- rethrows the first failure once all steps have run, with any later failures attached as
suppressed exceptions.
The host directory deletion moves into a small package-private method so the unit test can run
`tearDown` without touching the real `/tmp/seatunnel_mnt`. What it deletes is unchanged.
`AbstractTestSparkContainer` and `SeaTunnelContainer` use a similar exec-then-stop teardown and
may deserve the same treatment in a follow-up. They are not changed here.
### Does this PR introduce _any_ user-facing change?
No. Test infrastructure only.
### How was this patch tested?
**Unit tests (red → green).** Added `AbstractTestFlinkContainerTest`. It uses mocked
containers and replaces the host directory deletion with a flag:
- `shouldStopJobManagerWhenTaskManagerIsNotRunning`: on `dev`, `tearDown` throws
`IllegalStateException: execInContainer can only be used while the Container is running` and
never calls `jobManager.stop()`. With this PR it passes.
- `shouldStopJobManagerWhenCleaningTaskManagerVolumeFails`: on `dev`, fails with
`Wanted but not invoked: genericContainer.stop()`. With this PR, both containers are stopped and
the original exception is rethrown.
- `shouldKeepFirstFailureAndSuppressLaterOnes`: the TaskManager cleanup fails and the JobManager
stop also fails; the first failure is thrown and the second is attached as suppressed.
All three fail against the `dev` teardown logic and pass with this PR on JDK 8 and JDK 11,
together with the existing `seatunnel-e2e-common` unit tests (37 tests). A marker file in
`/tmp/seatunnel_mnt` survived the test run.
```
./mvnw -B verify -DskipUT=false -DskipIT=true -pl seatunnel-e2e/seatunnel-e2e-common -am \
-Dtest='AbstractTestFlinkContainerTest,SharedTestContainerResourceTest,SeaTunnelContainer*Test' -DfailIfNoTests=false
```
**E2E (local, harness not included in this PR).** Start a Flink 1.18 cluster, kill its
TaskManager, and call `tearDown()`. Then start a new cluster and run `fake_to_assert.conf`:
- `dev`: `tearDown()` threw in 11 of 11 runs (`ConflictException ... is not running`), and the
first JobManager was left running every time. In 6 of those 11 runs, the new TaskManager
registered with the leaked JobManager. The next job then hung for more than 120 s with
`Missing resources ... Current resources: (none)`.
- this PR: in every run (8 on an earlier revision of this change, 4 on the final one),
`tearDown()` completed, no JobManager was left running, the new TaskManager registered with its
own JobManager, and the job passed.
**Not verified:** how often a TaskManager fails to start on GitHub runners. I did not find this
sequence in the `kudu-connector-it` timeouts I checked, which have a different cause (#12132).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][E2E] Always stop E2E engine containers in teardown [seatunnel]
Posted by "goutamadwant (via GitHub)" <gi...@apache.org>.
goutamadwant commented on PR #12481:
URL: https://github.com/apache/seatunnel/pull/12481#issuecomment-5848012080
Thanks @SEZ9 @DanielLeens. Addressed in f1527cf9e and c00a8fd81:
1. **Spark and SeaTunnel:** the teardown is now shared in `AbstractTestContainer#stopContainersAndDeleteVolume` ([L156-L175](https://github.com/apache/seatunnel/blob/c00a8fd81d7498adf2521b76fc2b79d41c275afe/seatunnel-e2e/seatunnel-e2e-common/src/test/java/org/apache/seatunnel/e2e/common/container/AbstractTestContainer.java#L156-L175)), used by [Flink](https://github.com/apache/seatunnel/blob/c00a8fd81d7498adf2521b76fc2b79d41c275afe/seatunnel-e2e/seatunnel-e2e-common/src/test/java/org/apache/seatunnel/e2e/common/container/flink/AbstractTestFlinkContainer.java#L165), [Spark](https://github.com/apache/seatunnel/blob/c00a8fd81d7498adf2521b76fc2b79d41c275afe/seatunnel-e2e/seatunnel-e2e-common/src/test/java/org/apache/seatunnel/e2e/common/container/spark/AbstractTestSparkContainer.java#L89) and [SeaTunnel](https://github.com/apache/seatunnel/blob/c00a8fd81d7498adf2521b76fc2b79d41c275afe/seatunnel-e2e/seatunnel-e2e-common/src/test/java/org/apache/seatunnel/e2e/common/container/seatunnel/
SeaTunnelContainer.java#L266). `SeaTunnelContainer` calls `stop()` now; `GenericContainer.close()` only calls `stop()`.
2. **Best-effort `rm -rf`:** a failure is logged as WARN ([L211-L236](https://github.com/apache/seatunnel/blob/c00a8fd81d7498adf2521b76fc2b79d41c275afe/seatunnel-e2e/seatunnel-e2e-common/src/test/java/org/apache/seatunnel/e2e/common/container/AbstractTestContainer.java#L211-L236)). The exit code isn't checked because `rm` always exits 1 on the mount point ("Device or resource busy"). Only `stop()` and host-delete failures are rethrown, and the interrupt flag is kept ([L261-L271](https://github.com/apache/seatunnel/blob/c00a8fd81d7498adf2521b76fc2b79d41c275afe/seatunnel-e2e/seatunnel-e2e-common/src/test/java/org/apache/seatunnel/e2e/common/container/AbstractTestContainer.java#L261-L271)).
3. **Silent skip / host delete:** WARN when the cleanup is skipped and when the host path still exists ([L244-L254](https://github.com/apache/seatunnel/blob/c00a8fd81d7498adf2521b76fc2b79d41c275afe/seatunnel-e2e/seatunnel-e2e-common/src/test/java/org/apache/seatunnel/e2e/common/container/AbstractTestContainer.java#L244-L254)).
4. **Dead stub:** removed; the tests verify `never().execInContainer(...)` ([AbstractTestContainerTest](https://github.com/apache/seatunnel/blob/c00a8fd81d7498adf2521b76fc2b79d41c275afe/seatunnel-e2e/seatunnel-e2e-common/src/test/java/org/apache/seatunnel/e2e/common/container/AbstractTestContainerTest.java)).
All 51 `seatunnel-e2e-common` tests pass on JDK 8 and 11. Locally, killing the Spark master, Zeta server or Flink TaskManager and then calling `tearDown()` now removes the container, and the next job passes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][E2E] Always stop E2E engine containers in teardown [seatunnel]
Posted by "nzw921rx (via GitHub)" <gi...@apache.org>.
nzw921rx merged PR #12481:
URL: https://github.com/apache/seatunnel/pull/12481
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][E2E] Always stop E2E engine containers in teardown [seatunnel]
Posted by "SEZ9 (via GitHub)" <gi...@apache.org>.
SEZ9 commented on PR #12481:
URL: https://github.com/apache/seatunnel/pull/12481#issuecomment-5851879505
Thanks @goutamadwant for the follow-up in f1527cf9e and c00a8fd81. The approach you describe for the four points (shared `AbstractTestContainer#stopContainersAndDeleteVolume` teardown for Flink, Spark and SeaTunnel; best-effort `rm -rf` logged at WARN with only `stop()` and host-delete failures rethrown; WARN on skipped cleanup and remaining host path; `never().execInContainer(...)` verification replacing the dead stub) matches what was asked for. I'll go through the diff at c00a8fd81 to verify each point against the code and follow up here.
<!-- streview-comment:1336 -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org