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

[Proxy] Prevent leak of unreleased lookupRequestSemaphore permits #13812

Merged

Conversation

lhotari
Copy link
Member

@lhotari lhotari commented Jan 18, 2022

Motivation

  • permits could leak if an exception happens
    • permits should be released in a try-finally block

Modifications

  • use try-finally to release permits
  • refactor code
    • reduce duplication
    • increase encapsulation (get rid of this.service.getLookupRequestSemaphore())

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

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

+1

Copy link
Contributor

@nicoloboschi nicoloboschi left a comment

Choose a reason for hiding this comment

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

good catch

@lhotari lhotari merged commit 85b62e0 into apache:master Jan 19, 2022
codelipenghui pushed a commit that referenced this pull request Jan 21, 2022
…3812)

* [Proxy] Prevent leak of unreleased lookupRequestSemaphore permits

- should release permit in try-finally block

* Cleanup code in LookupProxyHandler

(cherry picked from commit 85b62e0)
@codelipenghui codelipenghui added cherry-picked/branch-2.9 Archived: 2.9 is end of life and removed release/2.8.3 labels Jan 21, 2022
lhotari added a commit to datastax/pulsar that referenced this pull request May 4, 2022
…ache#13812)

* [Proxy] Prevent leak of unreleased lookupRequestSemaphore permits

- should release permit in try-finally block

* Cleanup code in LookupProxyHandler

(cherry picked from commit 85b62e0)
lhotari added a commit to datastax/pulsar that referenced this pull request May 4, 2022
…ache#13812)

* [Proxy] Prevent leak of unreleased lookupRequestSemaphore permits

- should release permit in try-finally block

* Cleanup code in LookupProxyHandler

(cherry picked from commit 85b62e0)
lhotari added a commit to datastax/pulsar that referenced this pull request May 4, 2022
…ache#13812)

* [Proxy] Prevent leak of unreleased lookupRequestSemaphore permits

- should release permit in try-finally block

* Cleanup code in LookupProxyHandler

(cherry picked from commit 85b62e0)
lhotari added a commit that referenced this pull request Jun 1, 2022
…3812)

* [Proxy] Prevent leak of unreleased lookupRequestSemaphore permits

- should release permit in try-finally block

* Cleanup code in LookupProxyHandler

(cherry picked from commit 85b62e0)
(cherry picked from commit dcc07e8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/proxy cherry-picked/branch-2.9 Archived: 2.9 is end of life doc-not-needed Your PR changes do not impact docs release/2.9.2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants