Skip to content

Stacktrace about Reflective setAccessible(true) is ugly and should be removed from the output. #857

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

Closed
marco-brandizi opened this issue Mar 24, 2021 · 4 comments

Comments

@marco-brandizi
Copy link

marco-brandizi commented Mar 24, 2021

I'm switching to the latest version of Neo4j/Community and Java driver.

At some point, I get messages about Neo4j apparently probing the environment (see the attached log).

One of these end up with a quite ugly stacktrace starting from:

UnsupportedOperationException: Reflective setAccessible(true) disabled is ugly and should be removed from the output

After this, things seem to go ahead fine and my build succeeds, so the output above looks like a warning and noting is actually wrong, yet I expect it to confuse my end users.

It would be good if this output could be eliminated, eg, by intercepting the exception and reporting just a warning instead.

My understanding is also that setAccessible() has been disabled in most recent Java releases and it's not possible to use it anymore, so checking the running JVM version would allow for knowing this isn't available, without using the try/catch approach (if that's what the driver is doing, I haven't it clear).

Neo4j Version: 4.2.4 Community , Java Driver 4.2.3
Neo4j Mode: Single instance
Driver version: Java driver 4.2.3
Operating System: macOS 10.15.7 (but it's not relevant)
Java:

openjdk version "11.0.10" 2021-01-19
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.10+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.10+9, mixed mode)

Moreover, see the attached file

Steps to reproduce

Just try mvn install for this project of mine, I guess any driver instantiation produces this.

Expected behavior

Should not yield that output that look like an error to the non-expert user.

Actual behavior

It yields an ugly stack trace that, at a first look, can easily been mistaken for an actual error. That's bad mostly because it will likely trigger unnecessary complaints from end users.

@marco-brandizi marco-brandizi changed the title Stacktrace about UnsupportedOperationException: Reflective setAccessible(true) disabled is ugly and should be removed from the output. Stacktrace about Reflective setAccessible(true) is ugly and should be removed from the output. Mar 24, 2021
@fbiville
Copy link
Contributor

Hi, as the top of the stack trace suggests, this is first and foremost a Netty issue (even though Netty is shaded into the driver):

java.lang.UnsupportedOperationException: Reflective setAccessible(true) disabled
	at org.neo4j.driver.internal.shaded.io.netty.util.internal.ReflectionUtil.trySetAccessible(ReflectionUtil.java:31)
	at org.neo4j.driver.internal.shaded.io.netty.util.internal.PlatformDependent0$4.run(PlatformDependent0.java:238)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at org.neo4j.driver.internal.shaded.io.netty.util.internal.PlatformDependent0.<clinit>(PlatformDependent0.java:232)

Would the solution highlighted in netty/netty#7817 help?

@injectives
Copy link
Contributor

injectives commented Aug 5, 2021

It looks like this might have been improved in Netty 4.1.64+ (netty/netty#11164).
The driver was updated some time ago: #920, #938 and #937.
@marco-brandizi, would you be able to check if it improved with one of the following versions please?

  • 4.3.2
  • 4.3.3
  • 4.3.4
  • 4.2.7
  • 4.1.4

marco-brandizi added a commit to Rothamsted/kgraph-usecases that referenced this issue Aug 5, 2021
@marco-brandizi
Copy link
Author

@injectives many thanks, just tried the 4.3.4 and the long stack trace has gone! :-)

@injectives
Copy link
Contributor

@marco-brandizi, thank you for having a look. I will close this issue then. 👍

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

No branches or pull requests

3 participants