I found some strange behaviour when NettyStream is used in async driver with a CommandListener configured. See next code example: https://gist.github.com/jamel/957aab95a8385ef43768f378fb405d25
There I enabled high level of Netty resource leak detector to see any problems with resource leakage. When line
.addCommandListener(new NopCommandListener())
is commented all works just fine (see normal_run.log). But when that line is uncommented resource leak detector found some leaks (see buggy_run.log).
After playing with this bug a little bit I found that root cause of these leaks is ByteBufBsonDocument class. When instance of this class is created it takes ownership of given buffer (because bsonOutput.getByteBuffers() increments reference counter in each returning sub buffer). Unfortunately ByteBufBsonDocument class never releases its buffer and currently there is no way to do that.
- is related to
-
JAVA-2839 Memory leaks when using NettyStream and CommandListener
- Closed