Repository navigation
[BugFix] Keep PPLQueryTask free of opensearch module types (fixes alerting crash) - #5924
Conversation
opensearch-project#5910 made PPLQueryTask implement ProgressTrackingTask from the opensearch module. Plugins such as alerting load PPLQueryTask with this plugin's classes plus core, ppl, and protocol, but not the opensearch module, so creating the task threw NoClassDefFoundError and crashed the node. Revert PPLQueryTask, drop ProgressTrackingTask, and keep each async query's tracker in a weak map keyed by its task. Add a test that the classes other plugins load reference no opensearch module types. Resolves opensearch-project#5923 Signed-off-by: Kai Huang <[email protected]>
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
Codecov Report✅ All modified and coverable lines are covered by tests. ❌ Your project check has failed because the head coverage (75.52%) is below the target coverage (99.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #5924 +/- ##
=========================================
Coverage 75.52% 75.52%
- Complexity 10440 10442 +2
=========================================
Files 969 969
Lines 41314 41318 +4
Branches 4711 4712 +1
=========================================
+ Hits 31201 31205 +4
Misses 8788 8788
Partials 1325 1325
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Description
Fixes a node crash in 3.10.0. Any PPL alerting monitor throws
NoClassDefFoundError: org/opensearch/sql/opensearch/executor/progress/ProgressTrackingTask, and because it is anErrorthe node exits (#5923).Cause: #5910 made
PPLQueryTaskimplementProgressTrackingTask, which lives in theopensearchmodule. Alerting (and skills) callPPLQueryActionwith anopensearch-sql-thinjar built from this plugin's classes plus thecore,ppl, andprotocoljars. That jar does not include theopensearchmodule, so the JVM cannot definePPLQueryTask.Fix:
PPLQueryTaskis reverted to its pre-[Feature][PPL] Report progress for asynchronous Calcite queries #5910 form, with no interface and no tracker field.ProgressTrackingTaskis removed.QueryProgressTracker.attach(task)keeps each async query's tracker in a weak map keyed by its task (identity:Taskdoes not overrideequals).QueryProgressTracker.current()looks it up through the task already set on the thread. OnlyTransportPPLQueryActioncallsattach, and it runs in this plugin's own classloader.Guard:
ThinJarClassesTestfails ifPPLQueryAction,TransportPPLQueryRequest,TransportPPLQueryResponse, orPPLQueryTask(the classes other plugins load) reference a type fromorg.opensearch.sql.opensearchthrough a superclass, interface, field, method, or constructor. With the oldPPLQueryTaskrestored, it fails and namesProgressTrackingTaskandQueryProgressTracker.Verification
PPLQueryTaskfrom a classloader with the plugin jar,core, and OpenSearch, but not theopensearchmodule (the alerting setup)NoClassDefFoundError: ProgressTrackingTaskjavap PPLQueryTaskextends CancellableTask implements ProgressTrackingTaskextends CancellableTaskThinJarClassesTestAsyncPPLProgressIT(progress still reported mid-query)AsyncPPLQueryLifecycleIT:opensearch:check,:opensearch-sql-plugin:checkEnd-to-end reproduction
The steps from #5923 were run on a single node: the 3.10.0-SNAPSHOT darwin distribution, plus job-scheduler, SQL, and alerting from staging build 12327 (sql
760eead1e, alertingc17572ecb).opensearch-sql-thin/core/ppl/protocolrebuilt from it the way alerting builds themstats count()[[1]][[1]]ppl_monitorfatal error ... NoClassDefFoundError: .../ProgressTrackingTask_executethe monitortriggered: true, triggerppl_query_results: [{"cnt":1}](same as 3.9.0)ACTIVEalert with no errorfatal errororNoClassDefFoundErrorin the logsAlerting needs a rebuild against the new SQL snapshot to pick up the fixed thin jar; no alerting code change is needed.
Related Issues
Resolves #5923
Check List
--signoffor-s.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.