goutamadwant opened a new issue, #13246:
URL: https://github.com/apache/seatunnel/issues/13246

   ### Search before asking
   
   Searched open and closed issues/PRs for `"G1 Refine"`, `G1`, `system 
thread`, `thread leak` and `isSystemThread`. Related thread-cleanup changes do 
not classify this native worker.
   
   ### What happened
   
   The shared Zeta E2E leak detector can report a JVM-owned G1 refinement 
worker as a leaked job thread. This fails an otherwise completed test after the 
existing 120-second cleanup wait.
   
   `ContainerUtil.getJVMThreads` includes quoted native-worker records from 
`jstack`. `SeaTunnelContainer.doExecuteJob` compares thread names before and 
after the job. A G1 worker created after the first snapshot reaches 
`removeSystemThread`, but `isSystemThread` does not recognize its name.
   
   Observed Java 17 Python source and transform runs completed their jobs, then 
failed with retained native workers `G1 Refine#6` and `G1 Refine#5`, 
respectively. This is a test-harness classification failure, not evidence of a 
Python reader leak.
   
   ### SeaTunnel Version
   
   3.1.0-SNAPSHOT, dev `9cd7defe84e27c725ecf6dcf588be94f63477d4a`.
   
   ### SeaTunnel Config
   
   Existing E2E fixtures `python_to_assert.conf` and the Python transform 
fixtures. No new production configuration is needed.
   
   ### Before
   
   For a native worker created after the initial snapshot:
   
   ```text
   isSystemThread("G1 Refine#6") -> false
   completed job -> 120-second leak-check timeout -> failed E2E case
   ```
   
   ### After / proposed fix
   
   Recognize the complete native-worker name `G1 Refine#` followed by one or 
more ASCII digits, using a precompiled pattern and full-name matching.
   
   ```text
   isSystemThread("G1 Refine#6") -> true
   isSystemThread("app-G1 Refine#6") -> false
   isSystemThread("G1 Refine#6-worker") -> false
   ```
   
   The existing wait, classloader checks and other application-thread checks 
stay unchanged. Both filtering paths use the same predicate.
   
   OpenJDK confirms the native name and ownership: [JDK 17 
constructor](https://github.com/openjdk/jdk17u/blob/14a8c6288c963d6d61f12227375398d8abafc709/src/hotspot/share/gc/g1/g1ConcurrentRefineThread.cpp#L36)
 and [native GC-thread 
inheritance](https://github.com/openjdk/jdk17u/blob/14a8c6288c963d6d61f12227375398d8abafc709/src/hotspot/share/gc/g1/g1ConcurrentRefineThread.hpp#L37).
 The JDK 11 implementation uses the same naming convention.
   
   ### Reproduction and tests
   
   1. Extend the existing `SeaTunnelContainerThreadExemptionTest` with native 
IDs 0, 6 and 123, plus ten negative near-name cases.
   2. Run those tests against the unchanged classifier: 37 cases, exactly 3 
failures, zero errors/skips. The three failures are the native names.
   3. Apply the narrow classifier fix: all 37 cases pass on Java 11 and Java 
17, including all ten near-name negatives.
   
   To run the regression class after building its dependencies:
   
   ```sh
   mvn -B -pl seatunnel-e2e/seatunnel-e2e-common 
-Dtest=SeaTunnelContainerThreadExemptionTest -DskipIT=true test
   ```
   
   Maven 3.9.16 was used locally. Scoped formatting/verification also passed. 
Real Java 17 Zeta validation combining this correction with the separate Python 
image-preparation fix passed the source suite (3/3) and transform suite (4/4). 
These were actual project JUnit executions through a standalone launcher, not 
Maven Failsafe results.
   
   ### Java or Scala Version
   
   Classifier regression: Java 11 and 17. Observed engine false positive: Java 
17. No Java 11 runtime failure is claimed.
   
   ### Advantages
   
   Completed E2E jobs are no longer rejected solely because G1 starts a native 
refinement worker between snapshots. Application near names remain eligible for 
leak detection.
   
   ### Breaking changes and limitations
   
   No production code, APIs, options, dependencies or checkpoint formats 
change. No timeout increase or container reuse is introduced.
   
   The detector remains name based. An application deliberately using the 
identical native name would also be exempt. Native worker startup is workload 
dependent, so the unit regression is deterministic while the original runtime 
symptom is not guaranteed on every run. Other native thread families are 
outside this fix. Hosted CI is pending.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to