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

Unexpected exception encountered: java.lang.RuntimeException: Invalid StackMap offset 3: Invalid StackMap offset 3 #207

Closed
boyang9602 opened this issue Nov 13, 2019 · 7 comments
Assignees

Comments

@boyang9602
Copy link

Hi,
I met Unexpected exception encountered: java.lang.RuntimeException: Invalid StackMap offset 3: Invalid StackMap offset 3 when I use daikon to generate invariants for Closure project from defects4j.

Daikon 5.7.2
Java:

openjdk version "1.8.0_222"
OpenJDK Runtime Environment (build 1.8.0_222-8u222-b10-1ubuntu1~18.04.1-b10)
OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)

How to reproduce:

  1. compile defects4j: https://github.com/rjust/defects4j
  2. issue command defects4j checkout -p Closure -v 10f -w your_work_path
  3. go to your_work_path and issue command defects4j compile
  4. issue command java -Xmx10240M -cp lib/*:build/test/:build/classes/:build/lib/rhino.jar:build/lib/rhino1_7R4pre/js.jar:$DAIKONDIR/daikon.jar daikon.DynComp junit.textui.TestRunner com.google.javascript.jscomp.PeepholeFoldConstantsTest
  5. issue command java -Xmx10240M -cp lib/*:build/test/:build/classes/:build/lib/rhino.jar:build/lib/rhino1_7R4pre/js.jar:$DAIKONDIR/daikon.jar daikon.Chicory --comparability-file=TestRunner.decls-DynComp --daikon junit.textui.TestRunner com.google.javascript.jscomp.PeepholeFoldConstantsTest
    Then you will see the exception which occurs multiple times.

Thank you!

Unexpected exception encountered: java.lang.RuntimeException: Invalid StackMap offset 3: Invalid StackMap offset 3
	at org.plumelib.bcelutil.StackMapUtils.modify_stack_maps_for_switches(StackMapUtils.java:363)
	at daikon.chicory.Instrument.instrument_all_methods(Instrument.java:517)
	at daikon.chicory.Instrument.transform(Instrument.java:204)
	at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
	at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:428)
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at java.lang.Class.getDeclaringClass0(Native Method)
	at java.lang.Class.getDeclaringClass(Class.java:1235)
	at java.lang.Class.getEnclosingClass(Class.java:1277)
	at java.lang.Class.getSimpleBinaryName(Class.java:1443)
	at java.lang.Class.getSimpleName(Class.java:1309)
	at daikon.chicory.DaikonWriter.methodName(DaikonWriter.java:169)
	at daikon.chicory.DaikonWriter.methodEntryName(DaikonWriter.java:46)
	at daikon.chicory.DeclWriter.print_decl_class(DeclWriter.java:273)
	at daikon.chicory.DeclWriter.printDeclClass(DeclWriter.java:120)
	at daikon.chicory.Runtime.process_new_classes(Runtime.java:460)
	at daikon.chicory.Runtime.exit(Runtime.java:332)
	at com.google.javascript.rhino.head.Kit.classOrNull(Kit.java:74)
	at com.google.javascript.rhino.head.Context.<clinit>(Context.java:2439)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:264)
	at com.google.javascript.rhino.head.Kit.classOrNull(Kit.java:74)
	at com.google.javascript.rhino.head.ScriptRuntime.<clinit>(ScriptRuntime.java:157)
	at com.google.javascript.jscomp.RhinoErrorReporter.<init>(RhinoErrorReporter.java:72)
	at com.google.javascript.jscomp.RhinoErrorReporter.<init>(RhinoErrorReporter.java:32)
	at com.google.javascript.jscomp.RhinoErrorReporter$OldRhinoErrorReporter.<init>(RhinoErrorReporter.java:135)
	at com.google.javascript.jscomp.RhinoErrorReporter$OldRhinoErrorReporter.<init>(RhinoErrorReporter.java:131)
	at com.google.javascript.jscomp.RhinoErrorReporter.forOldRhino(RhinoErrorReporter.java:100)
	at com.google.javascript.jscomp.Compiler.<init>(Compiler.java:168)
	at com.google.javascript.jscomp.Compiler.<init>(Compiler.java:230)
	at com.google.javascript.jscomp.CompilerTestCase.createCompiler(CompilerTestCase.java:1058)
	at com.google.javascript.jscomp.CompilerTestCase.test(CompilerTestCase.java:429)
	at com.google.javascript.jscomp.CompilerTestCase.test(CompilerTestCase.java:371)
	at com.google.javascript.jscomp.CompilerTestCase.test(CompilerTestCase.java:340)
	at com.google.javascript.jscomp.CompilerTestCase.test(CompilerTestCase.java:328)
	at com.google.javascript.jscomp.CompilerTestCase.testSame(CompilerTestCase.java:560)
	at com.google.javascript.jscomp.PeepholeFoldConstantsTest.foldSame(PeepholeFoldConstantsTest.java:66)
	at com.google.javascript.jscomp.PeepholeFoldConstantsTest.testIssue821(PeepholeFoldConstantsTest.java:73)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at junit.framework.TestCase.runTest(TestCase.java:168)
	at junit.framework.TestCase.runBare(TestCase.java:134)
	at junit.framework.TestResult$1.protect(TestResult.java:110)
	at junit.framework.TestResult.runProtected(TestResult.java:128)
	at junit.framework.TestResult.run(TestResult.java:113)
	at junit.framework.TestCase.run(TestCase.java:124)
	at junit.framework.TestSuite.runTest(TestSuite.java:243)
	at junit.framework.TestSuite.run(TestSuite.java:238)
	at junit.textui.TestRunner.doRun(TestRunner.java:116)
	at junit.textui.TestRunner.start(TestRunner.java:180)
	at junit.textui.TestRunner.main(TestRunner.java:138)
@ShangwenWang
Copy link

Hello, I met the same problem recently.
I'd like to know is there any way to solve it.
Many thanks.

@markro49
Copy link
Contributor

markro49 commented Apr 8, 2020

I believe you omitted an important portion of the log files. When I followed your instructions I got a great many warnings of the form:

Chicory warning: ClassFile: com.google.protobuf.AbstractMessage$Builder - classfile version (49) is out of date and may not be processed correctly.

I suspect all the jar files in the lib directory have never been updated. Several (perhaps all) were built with Java 5. They need to be rebuilt with a much newer compiler. I would recommend Java 8 for now.

@boyang9602
Copy link
Author

Yes, there are such warnings. I will try to find the source and rebuild the libs. Thank you.

@mernst
Copy link
Member

mernst commented Apr 9, 2020

It would be better for Daikon to output a clear error message when it is provided with classfiles that are too old and do not contain the information that its instrumentation needs. Is that possible?

@markro49
Copy link
Contributor

markro49 commented Apr 9, 2020 via email

@markro49
Copy link
Contributor

The problem was an error in bcelutil/StackMapUtils. I have corrected the source, but we need to make a new release of bcel-util.jar.

@markro49 markro49 assigned mernst and unassigned markro49 Jul 17, 2020
@markro49
Copy link
Contributor

I should mention that even with this fix the original program will not run to completion as it runs out of Java heap space. It will probably require use of some combination of the --ppt-select-parttern and/or --ppt-omit-pattern options to get the generated data down to a manageable size.

@mernst mernst closed this as completed in bad7069 Jul 17, 2020
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

4 participants