Tian Jiang created IOTDB-6256:
---------------------------------
Summary: Deadlock when calling FLUSH
Key: IOTDB-6256
URL: https://issues.apache.org/jira/browse/IOTDB-6256
Project: Apache IoTDB
Issue Type: Bug
Components: Core/Engine
Reporter: Tian Jiang
Assignee: Tian Jiang
Fix For: master branch
Attachments: image-2023-11-23-19-30-31-905.png,
image-2023-11-23-19-36-00-222.png, image-2023-11-23-19-36-36-198.png,
image-2023-11-23-19-39-32-027.png
There is a deadlock issue which can be triggered by the FLUSH command in the
following condition:
1. The main thread constructs sub-threads of closing tsfiles.
!image-2023-11-23-19-30-31-905.png!
2. The last sub-thread is near its end and removes itself from
''closingSequenceTsFileProcessors''. Then the main thread breaks the while
loop, holds ''closeStroageGroupCondition'', and uses ''future.get'' to wait for
the sub-thread.
!image-2023-11-23-19-36-00-222.png!
!image-2023-11-23-19-36-36-198.png!
3. Unfortunately, since the main thread holds the condition, the sub-thread
cannot hold it and gets stuck. The main thread is also blocked by the
sub-thread through "future.get", so there is a deadlock.
!image-2023-11-23-19-39-32-027.png!
The solution is simple: there is no need for the main thread to wait for the
sub-threads while holding the condition, and the waiting can be done outside of
the synchronization block.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)