Skip to content

[ci] License checks leave directory streams open on traversal failure - #10449

Closed
taoran92 wants to merge 1 commit into
apache:masterfrom
taoran92:fix/ci-close-directory-streams
Closed

taoran92 wants to merge 1 commit into
apache:masterfrom
taoran92:fix/ci-close-directory-streams

Conversation

@taoran92

@taoran92 taoran92 commented Oct 8, 2026

Copy link
Copy Markdown
Member

Purpose

Fixes #10445.

CI license checks can leave directory resources open when traversal or filtering fails in JarFileChecker.getBuildJars() or NoticeFileChecker.findNoticeFiles(). Wrap both Files.walk() streams in try-with-resources to ensure cleanup on success and failure.

Tests

  • mvn -o -pl tools/ci/paimon-ci-tools -DwildcardSuites=none -Dtest=JarFileCheckerTest,NoticeFileCheckerTest test passed: 27 tests, including Checkstyle and Spotless checks.
  • git diff --check passed.
  • No new tests were added for this resource-lifetime change.

@taoran92
taoran92 marked this pull request as draft October 9, 2026 02:36
@taoran92
taoran92 marked this pull request as ready for review October 9, 2026 02:37
@taoran92
taoran92 force-pushed the fix/ci-close-directory-streams branch from 4b28049 to e69768c Compare October 9, 2026 02:43
@taoran92
taoran92 force-pushed the fix/ci-close-directory-streams branch from e69768c to 800b0a2 Compare October 9, 2026 08:51
@JingsongLi

Copy link
Copy Markdown
Contributor

Closing under the requested production/end-to-end contribution triage.

I traced both walkers to LicenseChecker.main and the current artifact-licensing workflow. The checker runs once in an isolated mvn exec:java ... -N step; a traversal/filtering exception aborts that step. The proposed try-with-resources change does not change a licensing result, recover the failed check, or address a demonstrated long-lived/repeated caller. Successful exhaustive Files.walk traversal already closes its directory iterators. The linked #10138 concerns Files.list during sink configuration loading, where resources can remain open after successful loading; that is a different lifecycle.

The implementation is straightforward and the 27 JarFileCheckerTest / NoticeFileCheckerTest tests passed on JDK 8 with standard Maven validation. For this standalone CI failure path, the current evidence supports resource-cleanup hygiene but does not establish an end-to-end production or CI reliability outcome that warrants a separate contribution. A real repeated invocation, recovery path, or failing licensing workload caused by retained directory resources would justify reopening with targeted evidence.

Reviewed head: 800b0a2e8bf50e752cecedfd29958dbf5111e677.

@JingsongLi JingsongLi closed this Oct 9, 2026
@taoran92
taoran92 deleted the fix/ci-close-directory-streams branch October 12, 2026 03:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] License checks leave directory streams open on traversal failure

2 participants