-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #10217 - Review ProxyConnectionFactory buffer management. #10225
Fixes #10217 - Review ProxyConnectionFactory buffer management. #10225
Conversation
Fixed buffer leak in ProxyConnection classes. Introduced ArrayByteBufferPool.LeakTracking to test buffer leaks. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's mostly the name of the LeakTracking
class that bothers me, the rest LGTM.
* the {@link Buffer}s that have been leaked, which contain | ||
* the stack trace information of where the buffer was acquired.</p> | ||
*/ | ||
public static class LeakTracking extends ArrayByteBufferPool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strictly speaking, this doesn't track leaks but acquisitions as it's up to the user of this class to know when it is safe to make leak assertions.
I'd prefer to see it renamed as it's public.
{ | ||
private static final Logger LOG = LoggerFactory.getLogger(LeakTracking.class); | ||
|
||
private final Set<Buffer> buffers = Collections.newSetFromMap(new ConcurrentHashMap<>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private final Set<Buffer> buffers = Collections.newSetFromMap(new ConcurrentHashMap<>()); | |
private final Set<Buffer> buffers = ConcurrentHashMap.newKeySet() |
@@ -204,25 +193,36 @@ public void onFillable() | |||
} | |||
|
|||
@Override | |||
public void onOpen() | |||
public void onFillable() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fact that you flipped onOpen()
and onFillable()
's order makes this review unnecessarily more complex to follow, as it makes it more complex to find back the places where you added the missing release()
calls.
Could you please restore their original order?
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Fixed buffer leak in ProxyConnection classes.
Introduced ArrayByteBufferPool.LeakTracking to test buffer leaks.