eolivelli commented on issue #271: LedgerHandle#readEntries leaks ByteBufs if 
getEntry not called or getEntryInputStream() not called and closed
URL: https://github.com/apache/bookkeeper/issues/271#issuecomment-317019864
 
 
   My proposal is not good, because the ByteBufInputStream will usually survive 
after the LedgerHandle#close.
   
   We need to find a solution at least for:
   - errors during asyncAddEntry callback execution
   
   But I think that we could introduce some leaks in downstream applications, 
because in 4.4 it clients are not required to fully consume every read entry
   
   The best would be not to return a simple "Enumeration" but at least a 
subclass with an explicit "close" method (implementing AutoCloseable for 
instance) and document that such 'resource' must be closed
   
   ```
   public interface EntriesEnumeration extends Enumeration, AutoCloseable {
          ...
   }
   ```
   
   This will be a breaking change, but I think that we already have introduced 
many breaking changes in the API (PlacementPolicy and Netty4 
HashedWheelTimer.....)
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to