Skip to content
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

Merged

Conversation

sbordet
Copy link
Contributor

@sbordet sbordet commented Aug 4, 2023

Fixed buffer leak in ProxyConnection classes.
Introduced ArrayByteBufferPool.LeakTracking to test buffer leaks.

Fixed buffer leak in ProxyConnection classes.
Introduced ArrayByteBufferPool.LeakTracking to test buffer leaks.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@sbordet sbordet requested review from gregw and lorban August 4, 2023 16:42
@sbordet sbordet linked an issue Aug 4, 2023 that may be closed by this pull request
Copy link
Contributor

@lorban lorban left a 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
Copy link
Contributor

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<>());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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()
Copy link
Contributor

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>
@sbordet sbordet requested a review from lorban August 16, 2023 09:48
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@sbordet sbordet merged commit 17c3649 into jetty-12.0.x Aug 16, 2023
@sbordet sbordet deleted the fix/jetty-12-10217-review-proxyconnectionfactory-buffers branch August 16, 2023 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Review ProxyConnectionFactory buffer management
2 participants