Skip to content

Commit 10167d3

Browse files
committed
Revert NettyByteBuf.asReadOnly change (mongodb#1871)
Originally introduced in 057649f This change had the unintended side effect of leaking netty ByteBufs when logging. JAVA-5982
1 parent 9a09dac commit 10167d3

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

driver-core/src/main/com/mongodb/internal/connection/netty/NettyByteBuf.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ public ByteBuf limit(final int newLimit) {
251251

252252
@Override
253253
public ByteBuf asReadOnly() {
254-
return new NettyByteBuf(proxied.asReadOnly().retain(), false);
254+
return this;
255255
}
256256

257257
@Override

driver-core/src/test/functional/com/mongodb/internal/connection/CommandHelperSpecification.groovy

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import com.mongodb.connection.SocketSettings
2525
import com.mongodb.internal.connection.netty.NettyStreamFactory
2626
import org.bson.BsonDocument
2727
import org.bson.BsonInt32
28+
import spock.lang.Ignore
2829
import spock.lang.Specification
2930

3031
import java.util.concurrent.CountDownLatch
@@ -52,9 +53,11 @@ class CommandHelperSpecification extends Specification {
5253
}
5354

5455
def cleanup() {
56+
InternalStreamConnection.setRecordEverything(false)
5557
connection?.close()
5658
}
5759

60+
@Ignore("JAVA-5982")
5861
def 'should execute command asynchronously'() {
5962
when:
6063
BsonDocument receivedDocument = null

0 commit comments

Comments
 (0)