zhangshenghang opened a new pull request, #13359:
URL: https://github.com/apache/seatunnel/pull/13359

   ### Purpose of this pull request
   
   Harden the shipped engine JVM defaults in `config/jvm_options`, 
`config/jvm_master_options` and `config/jvm_worker_options`. No code path 
changes; this only changes how the JVM reacts in three situations that are 
currently handled very conservatively.
   
   **1. `-XX:MetaspaceSize=256m`**
   
   The JVM default is about 20 MB. Engine startup plus connector plugin loading 
(amplified by `classloader-cache-mode`) crosses that mark early and triggers a 
metadata GC cycle before the node has served any task. Raising the initial 
high-water mark keeps that extra collection out of startup. 
`-XX:MaxMetaspaceSize=2g` (already present) still caps the space, and this is a 
GC trigger, not a reservation, so nothing is allocated up front.
   
   **2. `-XX:+ExplicitGCInvokesConcurrent`**
   
   Netty (direct buffer cleanup), RMI and some JDBC drivers call `System.gc()`. 
The default reaction is a stop-the-world full GC. On a multi-gigabyte engine 
heap that is a minutes-long pause for work that the collector could do 
concurrently. This converts those explicit calls into a concurrent cycle. Note 
that `-XX:+DisableExplicitGC` is intentionally not used: it would delay direct 
buffer reclamation and turn the problem into `OutOfMemoryError: Direct buffer 
memory`.
   
   **3. `-XX:+ExitOnOutOfMemoryError`**
   
   Without it, an `OutOfMemoryError` that is caught by a framework (thread pool 
task wrapper, global exception handler) leaves the process alive with a full 
heap: the member keeps heartbeating and keeps receiving tasks while it cannot 
make progress, so the cluster sees a healthy node that never finishes anything. 
Exiting after the heap dump is written hands recovery to the supervisor and to 
job failover.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, for users who rely on the shipped defaults:
   
   - An engine member now exits (exit code 3) after an OOM instead of staying 
up in a degraded state. Operators that run without a supervisor should be aware 
of this; the heap dump is still written first because 
`-XX:+HeapDumpOnOutOfMemoryError` is evaluated before the exit.
   - Explicit `System.gc()` calls no longer cause a stop-the-world full GC.
   - Metaspace starts its first collection cycle later.
   
   No data format, protocol, configuration schema or connector behavior 
changes. Existing customized copies of these files are unaffected; the change 
applies to the files shipped in the distribution.
   
   ### How was this patch tested?
   
   Config-only change, no Java code touched, so no unit test is added.
   
   - All three are standard HotSpot product flags available since JDK 8, and 
the project baseline is Java 11 (with JDK 17 CI lanes), so they are accepted on 
every supported runtime.
   - Verified locally that the three flags are accepted and take effect 
(`GCTimeRatio`/`MaxGCPauseMillis` untouched, `MetaspaceSize := 268435456`, 
`ExplicitGCInvokesConcurrent := true`, `ExitOnOutOfMemoryError := true`), and 
that the OOM path writes the dump first and then exits with code 3.
   - Full compilation / testing is left to the CI lanes on this PR (per the 
project rule that local verification for this repository is limited to 
formatting checks; no Java sources are modified here).
   - GC logging stays commented out by default, unchanged by this PR.
   


-- 
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