[ 
https://issues.apache.org/jira/browse/CASSANDRA-18708?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17752225#comment-17752225
 ] 

Ekaterina Dimitrova edited comment on CASSANDRA-18708 at 8/9/23 5:23 PM:
-------------------------------------------------------------------------

I can see the same error in the logs when we run RefCountedTest. The tests 
succeed, but we see the error printed from 
[here|https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/utils/concurrent/Ref.java#L571-L574]

StandaloneSplitterWithCQLTesterTest is explicitly checking tool logs for 
errors. Thus this class fails occasionally.
To solve the problem, we can use Unsafe. Unfortunately, this might not work in 
rare cases - not accessible lambda, and when we move to post-15 Java, Cassandra 
builds with records and hidden classes. (Unsafe#objectFieldOffset in Java 17 
throws UnsupportedOperationException when it sees a hidden class(lambda is 
implemented using hidden classes) or record). In case we see again in the 
future inaccessible object exceptions because of lambdas, we will need to use 
add-opens for those cases. 

I also added a new exception type for more clarity - 
UnaccessibleFieldException. Jamm has almost the same one, but the name is 
CannotAccessFieldException. I intentionally made those two with different names 
to avoid confusing them in the code/logs.
I considered adding a utility class, but I do not want to encourage people to 
use Unsafe tricks broadly.
With the proposed patch, I saw no more exceptions in the RefCountedTest logs.
The patch is highly influenced by what was done in Jamm. [~blerer], do you mind 
reviewing?
Patch: 
https://github.com/apache/cassandra/pull/2558/commits/fc7378072d1ca6b117fc3b56a4d7d3db4704ea5a
CI JDK11: 
https://app.circleci.com/pipelines/github/ekaterinadimitrova2/cassandra/2459/workflows/ea002384-b9ce-4360-bad1-f98cbf45e73e
CI JDK17: 
https://app.circleci.com/pipelines/github/ekaterinadimitrova2/cassandra/2459/workflows/ee61a0ae-b785-449e-a055-8d94e9035d87
J17 on J11 DTests failed due to some CircleCI problems - restarted and 
completed successfully here - 
https://app.circleci.com/pipelines/github/ekaterinadimitrova2/cassandra/2459/workflows/75c48124-e607-4fbb-8b43-96f87334c87e


 


was (Author: e.dimitrova):
I can see the same error in the logs when we run RefCountedTest. The tests 
succeed, but we see the error printed from 
[here|https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/utils/concurrent/Ref.java#L571-L574]

StandaloneSplitterWithCQLTesterTest is explicitly checking tool logs for 
errors. Thus this class fails occasionally.
To solve the problem, we can use Unsafe. Unfortunately, this might not work in 
rare cases - not accessible lambda, and when we move to post-15 Java, Cassandra 
builds with records and hidden classes. (Unsafe#objectFieldOffset in Java 17 
throws UnsupportedOperationException when it sees a hidden class(lambda is 
implemented using hidden classes) or record).

I also added a new exception type for more clarity - 
UnaccessibleFieldException. Jamm has almost the same one, but the name is 
CannotAccessFieldException. I intentionally made those two with different names 
to avoid confusing them in the code/logs.
I considered adding a utility class, but I do not want to encourage people to 
use Unsafe tricks broadly.
With the proposed patch, I saw no more exceptions in the RefCountedTest logs.
The patch is highly influenced by what was done in Jamm. [~blerer], do you mind 
reviewing?
Patch: 
https://github.com/apache/cassandra/pull/2558/commits/fc7378072d1ca6b117fc3b56a4d7d3db4704ea5a
CI JDK11: 
https://app.circleci.com/pipelines/github/ekaterinadimitrova2/cassandra/2459/workflows/ea002384-b9ce-4360-bad1-f98cbf45e73e
CI JDK17: 
https://app.circleci.com/pipelines/github/ekaterinadimitrova2/cassandra/2459/workflows/ee61a0ae-b785-449e-a055-8d94e9035d87
J17 on J11 DTests failed due to some CircleCI problems - restarted and 
completed successfully here - 
https://app.circleci.com/pipelines/github/ekaterinadimitrova2/cassandra/2459/workflows/75c48124-e607-4fbb-8b43-96f87334c87e


 

> Test failure: 
> org.apache.cassandra.tools.StandaloneSplitterWithCQLTesterTest.testNoSnapshotOption-.jdk17
> --------------------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-18708
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-18708
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Test/unit
>            Reporter: Ekaterina Dimitrova
>            Assignee: Ekaterina Dimitrova
>            Priority: Normal
>             Fix For: 5.x
>
>
> Seen here:
> [https://ci-cassandra.apache.org/job/Cassandra-trunk/1650/testReport/junit/org.apache.cassandra.tools/StandaloneSplitterWithCQLTesterTest/testNoSnapshotOption__jdk17/]
> h3.  
> {code:java}
> Error Message
> java.lang.reflect.InaccessibleObjectException: Unable to make field private 
> final sun.nio.fs.UnixFileSystem sun.nio.fs.UnixPath.fs accessible: module 
> java.base does not "opens sun.nio.fs" to unnamed module @1f28c152 at 
> java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
>  at 
> java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
>  at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:178) 
> at java.base/java.lang.reflect.Field.setAccessible(Field.java:172) at 
> org.apache.cassandra.utils.concurrent.Ref.getFields(Ref.java:656) at 
> org.apache.cassandra.utils.concurrent.Ref$Visitor.traverse(Ref.java:613) at 
> org.apache.cassandra.utils.concurrent.Ref$Visitor.run(Ref.java:568) at 
> org.apache.cassandra.concurrent.ExecutionFailure$1.run(ExecutionFailure.java:133)
>  at 
> java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
>  at 
> java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) at 
> java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
>  at 
> java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
>  at 
> java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
>  at 
> io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
>  at java.base/java.lang.Thread.run(Thread.java:833)
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to