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

JTreg test fail : java/lang/invoke/lambda/LambdaStackTrace.java #3394

Closed
ben-walsh opened this issue Oct 22, 2018 · 7 comments · Fixed by #3627
Closed

JTreg test fail : java/lang/invoke/lambda/LambdaStackTrace.java #3394

ben-walsh opened this issue Oct 22, 2018 · 7 comments · Fixed by #3627

Comments

@ben-walsh
Copy link
Contributor

Test https://github.com/ibmruntimes/openj9-openjdk-jdk11/blob/openj9/test/jdk/java/lang/invoke/lambda/LambdaStackTrace.java fails with ...

Actual trace did not match expected trace at frame 1
Expected frame patterns:
  0: LambdaStackTrace\\..*
  1: LambdaStackTrace.testBasic
Actual frames:
  0: LambdaStackTrace.lambda$testBasic$0(LambdaStackTrace.java:63)
  1: LambdaStackTrace$$Lambda$20.000000000000D7F0.run(Unknown Source)
java.lang.Exception: Incorrect stack frames found
	at LambdaStackTrace.verifyFrames(LambdaStackTrace.java:191)
	at LambdaStackTrace.testBasic(LambdaStackTrace.java:75)
	at LambdaStackTrace.main(LambdaStackTrace.java:53)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:115)
	at java.base/java.lang.Thread.run(Thread.java:825)

The synthetic frame (i.e. "LambdaStackTrace$$Lambda$20.000000000000D7F0.run(Unknown Source)") should not be present in the exception stack. See OpenJDK bug https://bugs.openjdk.java.net/browse/JDK-8025636.

Test passes against Hotspot.

Log archive : LambdaStackTraceProb.tar.gz

@tajila
Copy link
Contributor

tajila commented Oct 25, 2018

@fengxue-IS can you please take a look at this

@tajila
Copy link
Contributor

tajila commented Oct 25, 2018

The code responsible for creating stack traces is in /runtime/jcl/common/jclexception.c, specifically the getStackTraceIterator.

If the romClass has the J9AccClassAnonClass bit set in the extraModifiers it is an anonymousClass so you can remove that frame from the exception stack trace


Note: the steps above assume that they are removing the anonClass frames from the StackTraceElement[] (see Throwable.getInternalStackTrace()) and that they are not simply ignoring this frame when printing stack traces in Throwable.printStackTrace() . This should be verified first.

@fengxue-IS
Copy link
Contributor

looking into this

@tajila
Copy link
Contributor

tajila commented Oct 29, 2018

Update: There is an annotation called java/lang/invoke/LambdaForm$Hidden which is used to hide frames. This is the mechanism that hotspot uses to decide which frames to hide. We will have to look at this instead of the J9AccClassAnonClass (as previously mentioned) bit to determine whether to hide the frame or not. We can you use the existing mechanism (ClassFileOracle::KnownAnnotation) to detect this.

Also, -XX:+UnlockDiagnosticVMOptions -XX:+ShowHiddenFrames are used to force the frames to show up in stack traces. We may want to see if these options map to some of our existing options and just update their behaviour. If not we can implement one of them.

@tajila
Copy link
Contributor

tajila commented Oct 29, 2018

we have an existing annotiation Ljava/lang/invoke/MethodHandle$FrameIteratorSkip; that does something similar.

@smlambert
Copy link
Contributor

Test excluded: adoptium/aqa-tests#657

@babsingh
Copy link
Contributor

The test was re-enabled via adoptium/aqa-tests#3302.

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

Successfully merging a pull request may close this issue.

6 participants