Skip to content

Commit e6cabfa

Browse files
committed
Try closing channels for failed ops
1 parent 118d164 commit e6cabfa

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/main/java/com/emc/mongoose/storage/driver/coop/netty/NettyStorageDriverBase.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,15 +419,15 @@ protected int submit(final List<O> ops, final int from, final int to)
419419
LogUtil.exception(Level.WARN, e, "Failed to lease the connection for the load operation");
420420
nextOp.status(Operation.Status.FAIL_IO);
421421
complete(conn, nextOp);
422-
if (permits - n - 1 > 0) {
422+
if (permits - n > 1) {
423423
concurrencyThrottle.release(permits - n - 1);
424424
}
425425
} catch (final Throwable thrown) {
426426
throwUncheckedIfInterrupted(thrown);
427427
LogUtil.exception(Level.WARN, thrown, "Failed to submit the load operations");
428428
nextOp.status(Operation.Status.FAIL_UNKNOWN);
429429
complete(conn, nextOp);
430-
if (permits - n - 1 > 0) {
430+
if (permits - n > 1) {
431431
concurrencyThrottle.release(permits - n - 1);
432432
}
433433
}
@@ -595,6 +595,9 @@ public void complete(final Channel channel, final O op) {
595595
} catch (final IllegalStateException e) {
596596
LogUtil.exception(Level.DEBUG, e, "{}: invalid load operation state", op.toString());
597597
}
598+
if (op.status() != Operation.Status.SUCC) {
599+
channel.close();
600+
}
598601
if (!channel.attr(ATTR_KEY_RELEASED).get()) {
599602
concurrencyThrottle.release();
600603
if (channel != null) {

0 commit comments

Comments
 (0)