diff --git a/rpc/src/main/java/io/datakernel/rpc/protocol/stream/RpcStreamProtocol.java b/rpc/src/main/java/io/datakernel/rpc/protocol/stream/RpcStreamProtocol.java
index <HASH>..<HASH> 100644
--- a/rpc/src/main/java/io/datakernel/rpc/protocol/stream/RpcStreamProtocol.java
+++ b/rpc/src/main/java/io/datakernel/rpc/protocol/stream/RpcStreamProtocol.java
@@ -204,18 +204,14 @@ abstract class RpcStreamProtocol implements RpcProtocol {
 	@Override
 	public void close() {
 		sender.close();
-		deserializer.onProducerEndOfStream();
+		if (compression) {
+			decompressor.onProducerEndOfStream();
+		} else {
+			deserializer.onProducerEndOfStream();
+		}
 		connection.close();
-//		sender.close();
 	}
 
-//	private void closeProtocolWithError(Exception e) {
-//		sender.closeWithError(e);
-//		deserializer.onProducerError(e);
-//		receiver.closeWithError(e);
-//		connection.close();
-//	}
-
 	// JMX
 	public void startMonitoring() {
 		monitoring = true;
fix bug with buffer recycling in RpcStreamProtocol