Fix ClassInitializationSuite on JDK 21 #17249
All Vouch review confidence checks passed
Residual risk 0.23 = Change Risk (0.43) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 396 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.358
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #17249"
general
weight: 0.35
firestarman
Fixes #17237.
Description
ClassInitializationSuiteusesThread.suspend()andThread.resume()to force the class-initialization ordering needed to test the formerGpuOverrides/SparkShimImpldeadlock. JDK 21 disables those methods, causing the test harness to fail before it can evaluate the production initialization behavior.This change replaces forced thread suspension with a dependency-free cooperative hook. Its holder and production entry point are public so they remain accessible when multi-shim packaging loads shared and version-specific classes through different class loaders. The constructor and test-only install/clear methods remain non-public. The hook is unset in production and is invoked only once during
GpuOverridesclass initialization. The child reproducer installs the hook before initialization and usesCountDownLatchinstances to signal arrival and release the initializer deterministically. This preserves the original deadlock coverage without JDI or deprecated thread-control APIs.There is no user-facing behavior or configuration change.
Validation completed:
ClassInitializationSuitepassed 2/2 tests. Javac lint was disabled only to bypass the repository's existing Java 8 source/target warning promoted by-Werror.ClassInitializationSuitepassed 2/2 tests.shimExecsinitialization made the suite detect the original deadlock with exit code 2.Performance validation measured the uninstalled production hook on an Intel Core i7-8700K pinned to one CPU:
GpuOverridessingleton initialization; it is not on a per-query, per-task, or per-batch path.The Spark 5 profile was not run because its current test compilation remains blocked by #17236 and #17241. The JDK 21 behavior covered by this change was validated with the Spark 3.4 profile.
This change was developed with AI assistance.
Checklists
Documentation
Testing
Performance