Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

fix(java): address reachability issues in native image compilation with version 22.2.0 #1815

Merged
merged 2 commits into from
Oct 18, 2022

Conversation

mpeddada1
Copy link
Contributor

@mpeddada1 mpeddada1 commented Oct 7, 2022

Reproducer: https://github.com/mpeddada1/graalvm22.2-reachability. There were some changes introduced in GraalVM 22.2 which enabled reachibility handlers to be run concurrently by default. However, concurrent reachability doesn't seem to register classes correctly for reflection, therefore resulting in an error that looks like this for gapic libraries:

JUnit Vintage:BaseBigtableTableAdminClientTest:undeleteTableTest
    MethodSource [className = 'com.google.cloud.bigtable.admin.v2.BaseBigtableTableAdminClientTest', methodName = 'undeleteTableTest', methodParameterTypes = '']
    => java.lang.RuntimeException: Generated message class "com.google.bigtable.admin.v2.Table" missing method "getName".
       com.google.protobuf.GeneratedMessageV3.getMethodOrDie(GeneratedMessageV3.java:1929)
       com.google.protobuf.GeneratedMessageV3.access$1000(GeneratedMessageV3.java:79)
       com.google.protobuf.GeneratedMessageV3$FieldAccessorTable$SingularFieldAccessor$ReflectionInvoker.<init>(GeneratedMessageV3.java:2260)
       com.google.protobuf.GeneratedMessageV3$FieldAccessorTable$SingularFieldAccessor.<init>(GeneratedMessageV3.java:2334)
       com.google.protobuf.GeneratedMessageV3$FieldAccessorTable$SingularStringFieldAccessor.<init>(GeneratedMessageV3.java:3012)
       [...]
     Caused by: java.lang.NoSuchMethodException: com.google.bigtable.admin.v2.Table.getName()
       java.lang.Class.getMethod(DynamicHub.java:2108)
       com.google.protobuf.GeneratedMessageV3.getMethodOrDie(GeneratedMessageV3.java:1926)
       [...]

This change disables the support until this is fixed upstream.
Note: The RunReachabilityHandlersConcurrently option was introduced with GraalVM 22.2 and is unavailable in version 22.1.0.

@mpeddada1 mpeddada1 requested review from a team as code owners October 7, 2022 17:08
@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 7, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@mpeddada1 mpeddada1 merged commit 0f3215f into main Oct 18, 2022
@mpeddada1 mpeddada1 deleted the fix-reachability branch October 18, 2022 14:44
gcf-merge-on-green bot pushed a commit that referenced this pull request Oct 19, 2022
🤖 I have created a release *beep* *boop*
---


## [2.19.3](https://togithub.com/googleapis/gax-java/compare/v2.19.2...v2.19.3) (2022-10-19)


### Bug Fixes

* **deps:** Update dependency com.google.auth:google-auth-library-credentials to v1.12.0 ([#1822](https://togithub.com/googleapis/gax-java/issues/1822)) ([ad139e4](https://togithub.com/googleapis/gax-java/commit/ad139e45d29bd0fbf6b6f080b12ef9a987fa2e0d))
* **deps:** Update dependency com.google.auth:google-auth-library-credentials to v1.12.1 ([#1830](https://togithub.com/googleapis/gax-java/issues/1830)) ([d726921](https://togithub.com/googleapis/gax-java/commit/d7269210767a92e94568712920b34064278dddbc))
* **deps:** Update dependency com.google.auth:google-auth-library-oauth2-http to v1.12.0 ([#1823](https://togithub.com/googleapis/gax-java/issues/1823)) ([c6180ca](https://togithub.com/googleapis/gax-java/commit/c6180cacdaf4d191098e499eff0f6b014e730654))
* **deps:** Update dependency com.google.auth:google-auth-library-oauth2-http to v1.12.1 ([#1831](https://togithub.com/googleapis/gax-java/issues/1831)) ([227c8af](https://togithub.com/googleapis/gax-java/commit/227c8af66c95e86e8d90e5de9dd3f429895b44cc))
* **deps:** Update dependency com.google.protobuf:protobuf-bom to v3.21.8 ([#1828](https://togithub.com/googleapis/gax-java/issues/1828)) ([462a100](https://togithub.com/googleapis/gax-java/commit/462a1009a84a046da28298ad10f23cadfb7a61ea))
* **deps:** Update dependency io.grpc:grpc-bom to v1.50.1 ([#1819](https://togithub.com/googleapis/gax-java/issues/1819)) ([75600ea](https://togithub.com/googleapis/gax-java/commit/75600eab90ec2e33378c00824535763f5df87b24))
* **deps:** Update dependency org.graalvm.sdk:graal-sdk to v22.2.0.1 ([#1817](https://togithub.com/googleapis/gax-java/issues/1817)) ([a8f8ae2](https://togithub.com/googleapis/gax-java/commit/a8f8ae2b5e035dc08ce161134ec2e441e6c2d4fc))
* **deps:** Update dependency org.threeten:threetenbp to v1.6.3 ([#1821](https://togithub.com/googleapis/gax-java/issues/1821)) ([3bca572](https://togithub.com/googleapis/gax-java/commit/3bca572486e7780ff8fb8b581aa691738885401c))
* **java:** Address ClassNotFoundException in GraalVM 22.2.0 ([#1816](https://togithub.com/googleapis/gax-java/issues/1816)) ([ae6e8be](https://togithub.com/googleapis/gax-java/commit/ae6e8beb6ed5525504df1a3bb7ce71bdf114a233))
* **java:** Address reachability issues in native image compilation with version 22.2.0 ([#1815](https://togithub.com/googleapis/gax-java/issues/1815)) ([0f3215f](https://togithub.com/googleapis/gax-java/commit/0f3215f98bfc5def4e608c780d91953900e17946))

---
This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
@fniephaus
Copy link

Is -H:-RunReachabilityHandlersConcurrently still needed for this library in GraalVM 22.3.0 or later? It's unfortunately causing other user-facing issues (see oracle/graal#5868 (comment)).

@mpeddada1
Copy link
Contributor Author

Thank you for following up on this PR @fniephaus! Unfortunately, the issue persists even with GraalVM 22.3.0 and 22.3.1 being used (for reference: https://github.com/mpeddada1/graalvm22.2-reachability#does-this-sample-work-without-the-workaround-in-graalvm-2231-latest and related conversation). As mentioned in oracle/graal#5194, the issue started happening with GraalVM 22.2.0 when reachability handlers were made concurrent by default. We would really appreciate any insights/workarounds you may have to unblock this without having to disable the argument.

@fniephaus
Copy link

Thanks for checking. We're tracking oracle/graal#5194 internally and will follow up with more info soon.

@mpeddada1
Copy link
Contributor Author

Sounds great, thank you!

@fniephaus
Copy link

We've pushed a fix a while ago and it's now available in the latest GraalVM release. Could you please check again if -H:-RunReachabilityHandlersConcurrently is still needed?

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

Successfully merging this pull request may close these issues.

3 participants