This epic groups the tickets related to incorrect reference counting and the resource leaks caused by it.
Originally, using logging with netty would cause a IllegalReferenceCountException error when trying to read from a ByteBufBsonDocument.
This is because all byte buffers were released when creating the CompositeByteBuf and the components of the CompositeByteBuf were duplicated
using ByteBuf#asReadOnly. As the NettyByteBuf#asReadOnly just returned this. Netty would see the resources were freed and then would
throw a IllegalReferenceCountException when looking up the firstKey for the command name.
JAVA-5982 impelmented a fix for logging using netty by returning a new NettyByteBuf which would manage its resources.
Unintended consequences of JAVA-5982 were netty ByteBuf instances would leak due to the lack of resource management in ByteBufBsonDocument.
Reverting the fix means that using a LoggingCommandEventSender would no longer be possible using Netty and risks a IllegalReferenceCountException.