You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2025/08/26 12:24:27 UTC
(iotdb) branch FixLockNpe created (now f78997f46a4)
This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a change to branch FixLockNpe
in repository https://gitbox.apache.org/repos/asf/iotdb.git
at f78997f46a4 Fix potential NPE in tryGetFLushLock
This branch includes the following new commits:
new f78997f46a4 Fix potential NPE in tryGetFLushLock
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(iotdb) 01/01: Fix potential NPE in tryGetFLushLock
Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a commit to branch FixLockNpe
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit f78997f46a46a805eb01030cb061de1bb190609e
Author: JackieTien97 <ja...@gmail.com>
AuthorDate: Tue Aug 26 20:24:10 2025 +0800
Fix potential NPE in tryGetFLushLock
---
.../iotdb/db/storageengine/dataregion/DataRegion.java | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
index fc7977b8c12..243cccd6a41 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
@@ -2160,6 +2160,21 @@ public class DataRegion implements IDataRegionForQuery {
&& tsFileResource.isSatisfied(singleDeviceId, globalTimeFilter, true, isDebug)) {
TsFileProcessor tsFileProcessor = tsFileResource.getProcessor();
try {
+ if (tsFileProcessor == null) {
+ // tsFileProcessor == null means this tsfile is being closed, here we try to busy loop
+ // until status in TsFileResource has been changed which is supposed to be the last step
+ // of closing
+ while (!tsFileResource.isClosed() && waitTimeInMs > 0) {
+ TimeUnit.MILLISECONDS.sleep(5);
+ waitTimeInMs -= 5;
+ }
+ if (tsFileResource.isClosed()) {
+ continue;
+ } else {
+ clearAlreadyLockedList(needToUnLockList);
+ return false;
+ }
+ }
long startTime = System.nanoTime();
if (tsFileProcessor.tryReadLock(waitTimeInMs)) {
// minus already consumed time