[
https://issues.apache.org/jira/browse/IOTDB-1147?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17280085#comment-17280085
]
Jialin Qiao commented on IOTDB-1147:
------------------------------------
yes
> Concurrent in FlushManager cause NoSuchElementException error
> --------------------------------------------------------------
>
> Key: IOTDB-1147
> URL: https://issues.apache.org/jira/browse/IOTDB-1147
> Project: Apache IoTDB
> Issue Type: Bug
> Components: Core/Engine
> Reporter: Houliang Qi
> Assignee: Houliang Qi
> Priority: Major
> Labels: pull-request-available
> Fix For: 0.12.0
>
> Attachments: image-2021-02-04-10-57-43-980.png,
> image-2021-02-04-10-57-53-288.png, image-2021-02-04-11-04-05-375.png
>
>
>
> When we flush one tsfile, we put the TsFileProcessor to the FlushManager, and
> use another thread pool to do the flush task of the memtables in this
> TsFileProcessor.
>
> Howerver, the following codes is not thread safe, because when the first code
> _tsFileProcessorQueue.isEmpty()_ is called, it may be return false, but
> instantly it maybe become empty due to consumed by the flush thread pool, so
> when called
> _tsFileProcessorQueue.getFirst().getStorageGroupName()_ it may cause
> NoSuchElementException error.
>
> What's worse, this causes a TsFile not to be closed all the time, causing the
> write to get stuck.
> !image-2021-02-04-10-57-43-980.png|width=811,height=251!
> The error are as follows:
>
> !image-2021-02-04-10-57-53-288.png|width=821,height=228!
>
> !image-2021-02-04-11-04-05-375.png|width=827,height=287!
--
This message was sent by Atlassian Jira
(v8.3.4#803005)