xuanyuanking commented on code in PR #37260:
URL: https://github.com/apache/spark/pull/37260#discussion_r928165646
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/state/RocksDBLoader.scala:
##########
@@ -48,7 +48,16 @@ object RocksDBLoader extends Logging {
def loadLibrary(): Unit = synchronized {
if (exception == null) {
- loadLibraryThread.start()
+ // SPARK-39847: if a task thread is interrupted while blocking in this
loadLibrary()
+ // call then a second task thread might start a loadLibrary() call while
the first
Review Comment:
The second task thread is blocked by `synchronized`. Quoted the explain from
Josh with some highlight:
- ...
- If Task A is interrupted, an `InterruptedException` will be thrown and
**it will exit the loadLibrary synchronized block**.
- At this point, **Task B enters the synchronized block** of its
`loadLibrary() call and sees that `exception == null` because the
`loadLibraryThread` started by the other task is still running, so Task B calls
`loadLibraryThread.start()` and hits the thread state error because it tries to
start an already-started thread.
--
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]