-
Notifications
You must be signed in to change notification settings - Fork 399
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
[Improvement] GravitinoConnectorFactory.java writes to a static field is not thread-safe #2167
Comments
@justinmclean Which branch is this issue on? I'm not seeing this in |
It's on the main branch here: You'll note that is inside a synchronized block and catalogConnectorManager is static. |
@justinmclean Assuming I add add a nested sychronized block here such as: Thanks. |
…ticGuardedByInstance error-prone
…ticGuardedByInstance error-prone
…ticGuardedByInstance error-prone
…ticGuardedByInstance error-prone
…rdedByInstance error-prone (#2514) <!-- 1. Title: [#<issue>] <type>(<scope>): <subject> Examples: - "[#123] feat(operator): support xxx" - "[#233] fix: check null before access result in xxx" - "[MINOR] refactor: fix typo in variable name" - "[MINOR] docs: fix typo in README" - "[#255] test: fix flaky test NameOfTheTest" Reference: https://www.conventionalcommits.org/en/v1.0.0/ 2. If the PR is unfinished, please mark this PR as draft. --> ### What changes were proposed in this pull request? `StaticGuardedByInstance` amis to avoid `public static` fields. Because this field is not thread-safe. See more details at https://errorprone.info/bugpattern/StaticGuardedByInstance. In this MR, I remove some test code in `com.datastrato.gravitino.trino.connector.GravitinoPlugin` and `com.datastrato.gravitino.trino.connector.GravitinoConnectorFactory`. At the same time, I enable `StaticGuardedByInstance` error-prone. ### Why are the changes needed? - Fix: #2167 ### Does this PR introduce _any_ user-facing change? - no ### How was this patch tested? - original unit tests.
…ticGuardedByInstance error-prone (apache#2514) <!-- 1. Title: [#<issue>] <type>(<scope>): <subject> Examples: - "[apache#123] feat(operator): support xxx" - "[apache#233] fix: check null before access result in xxx" - "[MINOR] refactor: fix typo in variable name" - "[MINOR] docs: fix typo in README" - "[apache#255] test: fix flaky test NameOfTheTest" Reference: https://www.conventionalcommits.org/en/v1.0.0/ 2. If the PR is unfinished, please mark this PR as draft. --> ### What changes were proposed in this pull request? `StaticGuardedByInstance` amis to avoid `public static` fields. Because this field is not thread-safe. See more details at https://errorprone.info/bugpattern/StaticGuardedByInstance. In this MR, I remove some test code in `com.datastrato.gravitino.trino.connector.GravitinoPlugin` and `com.datastrato.gravitino.trino.connector.GravitinoConnectorFactory`. At the same time, I enable `StaticGuardedByInstance` error-prone. ### Why are the changes needed? - Fix: apache#2167 ### Does this PR introduce _any_ user-facing change? - no ### How was this patch tested? - original unit tests.
What would you like to be improved?
GravitinoConnectorFactory.java:65: warning: [StaticGuardedByInstance] Write to static variable should not be guarded by instance lock 'this'
GravitinoPlugin.catalogConnectorManager = catalogConnectorManager;
See https://errorprone.info/bugpattern/StaticGuardedByInstance
How should we improve?
No response
The text was updated successfully, but these errors were encountered: