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

TomEE - leak of AWSSecretsManagerOracleDriver objects #53

Open
Pete16384 opened this issue Dec 3, 2020 · 1 comment
Open

TomEE - leak of AWSSecretsManagerOracleDriver objects #53

Pete16384 opened this issue Dec 3, 2020 · 1 comment

Comments

@Pete16384
Copy link

Hello,

We are using the aws-secretsmanager-jdbc library in conjunction with TomEE and have been observing a leak of AWSSecretsManagerOracleDriver objects.

After adding some traces in the aws-secretsmanager-jdbc code, what we understood is:

  1. Each time a connection is created the TomEE framework instantiates a new AWSSecretsManagerOracleDriver object and sets it as the 'driver' attribute of the connection object (line 235 of TomEEDataSourceCreator.java - link here: https://github.com/apache/tomee/blob/master/tomee/tomee-jdbc/src/main/java/org/apache/tomee/jdbc/TomEEDataSourceCreator.java).

  2. When instantiated, the AWSSecretsManagerOracleDriver object registers itself in the 'DriverManager' (line 154 of AWSSecretsManagerDriver.java)

  3. When the connection is destroyed later, the driver object is apparently not deregistered from the 'DriverManager', so its stays indefinitely, which creates the leak.

We tried to disable the DriverManager registration in the AWSSecretsManagerOracleDriver constructor (just leaving the registration in the static initialization block of AWSSecretsManagerOracleDriver) and the leak has effectively disappeared. But we fear to have misunderstood something fundamental and that this workaround is not correct: we admit not being very familiar with the aforementioned frameworks. Could anyone shed some light?

@willtong1234 willtong1234 added the enhancement New feature or request label Jan 19, 2021
@willtong1234
Copy link
Contributor

It looks like something the Oracle driver does in their connect method that we can try to replicate is to deregister any duplicate drivers: https://github.com/mikesmithjr/ora-jdbc-source/blob/master/OracleJDBC/src/oracle/jdbc/driver/OracleDriver.java#L328-L344.

Labeling this as an enhancement that we can prioritize appropriately.

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