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

PinotDriver File Handle Leaks #12263

Closed
brandonwardell20 opened this issue Jan 12, 2024 · 1 comment
Closed

PinotDriver File Handle Leaks #12263

brandonwardell20 opened this issue Jan 12, 2024 · 1 comment

Comments

@brandonwardell20
Copy link

brandonwardell20 commented Jan 12, 2024

The PinotDriver.connect() method leaks the PinotClientTransport and PinotControllerTransport when an exception is thrown trying to construct the PinotConnection. This highly impacts applications that utilize other drivers, and eventually causes the server which has registered the driver to crash.

Suggested solution:

  1. Convert PinotClientTransport and PinotControllerTransport to temporary variables, and close them individually, and safely, when exceptions are thrown getting the connection. Like so:
try
{
            if (pinotClientTransport != null) {
                pinotClientTransport.close();
            }
        } catch (PinotClientException ignored) {
        }

        try {
            if (pinotControllerTransport != null) {
                pinotControllerTransport.close();
            }
        } catch (PinotClientException ignored) {
        }
  1. Add a URL check to return null if the URL is not expected, avoiding allocating resources altogether if not necessary.
    Like so: if (!this.acceptsURL(url)) { return null; }
@walterddr walterddr added the bug label Jan 17, 2024
BrendanStans21 pushed a commit to BrendanStans21/brendan-pinot-fork that referenced this issue Feb 2, 2024
@Jackie-Jiang
Copy link
Contributor

Fixed by #12356

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants