diff --git a/src/main/java/com/emc/mongoose/storage/driver/coop/netty/NettyStorageDriverBase.java b/src/main/java/com/emc/mongoose/storage/driver/coop/netty/NettyStorageDriverBase.java index 415ab53..e68f418 100755 --- a/src/main/java/com/emc/mongoose/storage/driver/coop/netty/NettyStorageDriverBase.java +++ b/src/main/java/com/emc/mongoose/storage/driver/coop/netty/NettyStorageDriverBase.java @@ -419,7 +419,7 @@ protected int submit(final List ops, final int from, final int to) LogUtil.exception(Level.WARN, e, "Failed to lease the connection for the load operation"); nextOp.status(Operation.Status.FAIL_IO); complete(conn, nextOp); - if (permits - n - 1 > 0) { + if (permits - n > 1) { concurrencyThrottle.release(permits - n - 1); } } catch (final Throwable thrown) { @@ -427,7 +427,7 @@ protected int submit(final List ops, final int from, final int to) LogUtil.exception(Level.WARN, thrown, "Failed to submit the load operations"); nextOp.status(Operation.Status.FAIL_UNKNOWN); complete(conn, nextOp); - if (permits - n - 1 > 0) { + if (permits - n > 1) { concurrencyThrottle.release(permits - n - 1); } } @@ -595,6 +595,9 @@ public void complete(final Channel channel, final O op) { } catch (final IllegalStateException e) { LogUtil.exception(Level.DEBUG, e, "{}: invalid load operation state", op.toString()); } + if (op.status() != Operation.Status.SUCC) { + channel.close(); + } if (!channel.attr(ATTR_KEY_RELEASED).get()) { concurrencyThrottle.release(); if (channel != null) {