-
- Downloads
Fix ref-counting when CompositeByteBuf is used with retainedSlice() (#8497)
Motivation: ByteBuf.retainedSlice() and similar methods produce sliced buffers with an independent refcount to the buffer that they wrap. One of the optimizations in 10539f4d was to use the ref to the unwrapped buffer object for added slices, but this did not take into account the above special case when later releasing. Thanks to @rkapsi for discovering this via #8495. Modifications: Since a reference to the slice is still kept in the Component class, just changed Component.freeIfNecessary() to release the slice in preference to the unwrapped buf. Also added a unit test which reproduces the bug. Result: Fixes #8495
Showing
- buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java 10 additions, 3 deletionsbuffer/src/main/java/io/netty/buffer/CompositeByteBuf.java
- buffer/src/test/java/io/netty/buffer/AbstractCompositeByteBufTest.java 34 additions, 0 deletions...st/java/io/netty/buffer/AbstractCompositeByteBufTest.java
Loading
Please register or sign in to comment