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

Add a lock around jdbc connection #11877

Merged
merged 9 commits into from
May 5, 2022
Merged

Add a lock around jdbc connection #11877

merged 9 commits into from
May 5, 2022

Conversation

hithwen
Copy link
Contributor

@hithwen hithwen commented Apr 21, 2022

Support case AGENT-7456.
A user is using five instances of this check and they were failing with this error:

2022-04-14 12:20:30 PDT | CORE | ERROR | (pkg/collector/python/datadog_agent.go:122 in LogMessage) | oracle:4369afcc1ec9cf0 | (core.py:128) | Error querying process: java.lang.UnsatisfiedLinkError: Native Library /opt/datadog-agent/embedded/lib/python3.8/site-packages/_jpype.cpython-38-x86_64-linux-gnu.so already loaded in another classloader

The problem seems to be a limitation of jpype itself about running it on multiple threads so this change introduces a lock around creating a connection.
A more severe approach has been explored in #11882 but the user has tested the changes here and found the issue resolved.

@hithwen hithwen requested review from a team as code owners April 21, 2022 16:14
@ghost ghost added the integration/oracle label Apr 21, 2022
@hithwen hithwen requested a review from a team as a code owner April 21, 2022 16:16
@codecov
Copy link

codecov bot commented Apr 21, 2022

Codecov Report

Merging #11877 (4d444bf) into master (540ca67) will increase coverage by 0.01%.
The diff coverage is 57.14%.

Flag Coverage Δ
oracle 91.39% <57.14%> (+2.71%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

jtappa
jtappa previously approved these changes Apr 21, 2022
Copy link
Contributor

@sarah-witt sarah-witt left a comment

Choose a reason for hiding this comment

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

Looks good, I don't think we are able to write tests for multiple instances, correct?

@hithwen
Copy link
Contributor Author

hithwen commented May 5, 2022

Looks good, I don't think we are able to write tests for multiple instances, correct?

A concurrency test would be hard to make reliable (the problem only appears when multiple instances are running simultaneously)

@hithwen hithwen merged commit df24d43 into master May 5, 2022
@hithwen hithwen deleted the js/AGENT-7456-jdbc-lock branch May 5, 2022 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants