You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2021/02/09 06:17:17 UTC
[hbase] branch branch-2.4 updated: HBASE-25507 Leak of ESTABLISHED
sockets when compaction encountered "java.io.IOException: Invalid HFile
block magic" (#2882)
This is an automated email from the ASF dual-hosted git repository.
stack pushed a commit to branch branch-2.4
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2.4 by this push:
new 6849279 HBASE-25507 Leak of ESTABLISHED sockets when compaction encountered "java.io.IOException: Invalid HFile block magic" (#2882)
6849279 is described below
commit 6849279023ae874a2a62c3cd6eede4a1b975f8b9
Author: haxl <li...@gmail.com>
AuthorDate: Tue Feb 9 14:14:00 2021 +0800
HBASE-25507 Leak of ESTABLISHED sockets when compaction encountered "java.io.IOException: Invalid HFile block magic" (#2882)
Signed-off-by: Ramkrishna <ra...@apache.org>
Signed-off-by: stack <st...@apache.org>
---
.../hbase/regionserver/compactions/Compactor.java | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/Compactor.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/Compactor.java
index be0a98e..59afeed 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/Compactor.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/Compactor.java
@@ -321,10 +321,10 @@ public abstract class Compactor<T extends CellSink> {
dropCache = this.dropCacheMinor;
}
- List<StoreFileScanner> scanners =
- createFileScanners(request.getFiles(), smallestReadPoint, dropCache);
InternalScanner scanner = null;
boolean finished = false;
+ List<StoreFileScanner> scanners =
+ createFileScanners(request.getFiles(), smallestReadPoint, dropCache);
try {
/* Include deletes, unless we are doing a major compaction */
ScanType scanType = scannerFactory.getScanType(request);
@@ -345,7 +345,18 @@ public abstract class Compactor<T extends CellSink> {
+ store.getRegionInfo().getRegionNameAsString() + " because it was interrupted.");
}
} finally {
- Closeables.close(scanner, true);
+ // createScanner may fail when seeking hfiles encounter Exception, e.g. even only one hfile
+ // reader encounters java.io.IOException: Invalid HFile block magic:
+ // \x00\x00\x00\x00\x00\x00\x00\x00
+ // and then scanner will be null, but scanners for all the hfiles should be closed,
+ // or else we will find leak of ESTABLISHED sockets.
+ if (scanner == null) {
+ for (StoreFileScanner sfs : scanners) {
+ sfs.close();
+ }
+ } else {
+ Closeables.close(scanner, true);
+ }
if (!finished && writer != null) {
abortWriter(writer);
}