Skip to content

Conversation

@eyalkoren
Copy link
Contributor

@eyalkoren eyalkoren commented Jun 15, 2021

What does this PR do?

The theory:
When multiple JDBC implementations on a Servlet container share a data source, they may also share JDBC connection instances. Since the connection --> metadata cache is managed as a global state across the entire JVM, and the created ConnectionMetaData values stored in it are created by the plugin, this may cause a ClassCastException if one JDBC driver is storing a metadata instance for a connection instance and another one is retrieving it.
Normally this is not an issue because there will be a single JDBC dependency, but there may be cases where there are multiple JDBC dependencies. It still requires a special setup where java.sql.Statement implementations are loaded from some class loader while the java.sql.Connection class is shared, so that the connection instances can be shared.

This PR fixes the issue by ensuring that the ConnectionMetaData is always loaded only by the agent class loader.

Checklist

  • This is a bugfix
@eyalkoren eyalkoren added the bug Bugs label Jun 15, 2021
@ghost
Copy link

ghost commented Jun 15, 2021

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: Branch indexing

  • Start Time: 2021-06-23T16:39:18.246+0000

  • Duration: 57 min 6 sec

  • Commit: 430b8d7

Test stats 🧪

Test Results
Failed 0
Passed 2245
Skipped 18
Total 2263

Trends 🧪

Image of Build Times

Image of Tests

💚 Flaky test report

Tests succeeded.

Expand to view the summary

Test stats 🧪

Test Results
Failed 0
Passed 2245
Skipped 18
Total 2263

@SylvainJuge SylvainJuge enabled auto-merge (squash) June 24, 2021 07:53
@SylvainJuge SylvainJuge merged commit c55a5b3 into elastic:master Jun 24, 2021
@ghost
Copy link

ghost commented Jun 24, 2021

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: Pull request #1864 updated

  • Start Time: 2021-06-24T07:53:25.894+0000

  • Duration: 56 min 42 sec

  • Commit: 6467d4f

Test stats 🧪

Test Results
Failed 0
Passed 2286
Skipped 19
Total 2305

Trends 🧪

Image of Build Times

Image of Tests

💚 Flaky test report

Tests succeeded.

Expand to view the summary

Test stats 🧪

Test Results
Failed 0
Passed 2286
Skipped 19
Total 2305

@eyalkoren eyalkoren deleted the jdbc-proper-loading-connection-metadata branch June 27, 2021 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants