anishshri-db opened a new pull request, #43413:
URL: https://github.com/apache/spark/pull/43413
### What changes were proposed in this pull request?
Ensure that store instance is not used after calling commit within output
mode streaming aggregation
### Why are the changes needed?
Without these changes, we were accessing the store instance to retrieve the
iterator even after the commit was called. When commit is called, we release
the DB instance lock. So its possible task retries can acquire the instance
lock and close the DB instance. So when the original thread tries to access the
DB, it might run into a null pointer exception. This change fixes the issue
```
org.apache.spark.sql.streaming.StreamingQueryException: Job aborted
due to stage failure: Task 0 in stage 5.0 failed 1 times, most recent failure:
Lost task 0.0 in stage 5.0 (TID 492)
(ip-10-110-25-116.us-west-2.compute.internal executor driver):
java.lang.NullPointerException
at
org.apache.spark.sql.execution.streaming.state.RocksDB.iterator(RocksDB.scala:337)
at
org.apache.spark.sql.execution.streaming.state.RocksDBStateStoreProvider$RocksDBStateStore.iterator(RocksDBStateStoreProvider.scala:79)
at
org.apache.spark.sql.execution.streaming.state.StreamingAggregationStateManagerImplV1.values(StreamingAggregationStateManager.scala:130)
at
org.apache.spark.sql.execution.streaming.StateStoreSaveExec.$anonfun$doExecute$5(statefulOperators.scala:543)
at
org.apache.spark.sql.execution.streaming.state.package$StateStoreOps.$anonfun$mapPartitionsWithStateStore$1(package.scala:63)
at
org.apache.spark.sql.execution.streaming.state.StateStoreRDD.compute(StateStoreRDD.scala:131)
at
org.apache.spark.rdd.RDD.$anonfun$computeOrReadCheckpoint$1(RDD.scala:407)
at
com.databricks.spark.util.ExecutorFrameProfiler$.record(ExecutorFrameProfiler.scala:110)
at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:404)
at org.apache.spark.rdd.RDD.iterator(RDD.scala:371)
```
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
RocksDBStreamingAggregationSuite
```
18:12:00.242 WARN
org.apache.spark.sql.streaming.RocksDBStateStoreStreamingAggregationSuite:
===== POSSIBLE THREAD LEAK IN SUITE
o.a.s.sql.streaming.RocksDBStateStoreStreamingAggregationSuite, threads:
ForkJoinPool.commonPool-worker-6 (daemon=true),
ForkJoinPool.commonPool-worker-4 (daemon=true),
ForkJoinPool.commonPool-worker-7 (daemon=true),
ForkJoinPool.commonPool-worker-5 (daemon=true),
ForkJoinPool.commonPool-worker-3 (daemon=true), state-store-maintenance-task
(daemon=true), rpc-boss-3-1 (daemon=true), ForkJoinPool.commonPool-worker-8
(daemon=true), shuffle-boss-6-1 (daemon=true), ForkJoinP...
[info] Run completed in 5 minutes, 8 seconds.
[info] Total number of tests run: 80
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 80, failed 0, canceled 0, ignored 0, pending 0
[info] All tests passed.
```
StreamingSessionWindowSuite
```
===== POSSIBLE THREAD LEAK IN SUITE
o.a.s.sql.streaming.StreamingSessionWindowSuite, threads:
ForkJoinPool.commonPool-worker-6 (daemon=true),
state-store-maintenance-thread-0 (daemon=true),
ForkJoinPool.commonPool-worker-4 (daemon=true),
state-store-maintenance-thread-1 (daemon=true),
ForkJoinPool.commonPool-worker-7 (daemon=true),
ForkJoinPool.commonPool-worker-5 (daemon=true),
ForkJoinPool.commonPool-worker-3 (daemon=true), state-store-maintenance-task
(daemon=true), rpc-boss-3-1 (daemon=true), ForkJoin...
[info] Run completed in 3 minutes, 38 seconds.
[info] Total number of tests run: 48
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 48, failed 0, canceled 0, ignored 0, pending 0
[info] All tests passed.
```
### Was this patch authored or co-authored using generative AI tooling?
No
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]