karate
karate copied to clipboard
Update Graal to v22.x
I use Quarkus 2.7.5.Final with Karate 1.2.0. I can't move to later versions of Quarkus as they rely on Graal v22 and Karate only works with v21. I'm aware there are some issues with moving to v22 as I've seen the tests fail myself but unfortunately, I don't have the knowledge or experience to help. Just creating this issue in the hope you can put it on the roadmap now that 1.2.0 is released. Thanks.
@edwardsph upgraded and a couple of things broke, which don't look too bad, but please check with your suites when you get a chance. 2 tests have been commented out
@joelpramos I think the solution is related to the changes you made in #1828 and I know that code and PR merge was done in a rush. I hope I get time to do a massive cleanup and use the Graal "child context" concept refer: https://github.com/oracle/graal/blob/master/docs/reference-manual/embedding/embed-languages.md#embed-guest-languages-in-guest-languages and discussion
CI failed:
Error: Failures:
Error: PaymentServiceContractTest.testPaymentService:33 Multi threaded access requested by thread Thread[main,5,main] but is not allowed for language(s) js.
classpath:mock/contract/payment-service.feature:17
just realized Graal 22.1 requires Java 11 ! https://github.com/oracle/graaljs/blob/master/CHANGELOG.md#version-2210
glad the build is set up to detect these problems:
Error: COMPILATION ERROR :
[INFO] -------------------------------------------------------------
Error: /karate/karate-e2e-tests/src/test/java/driver/JavaApiRunner.java:[33,60] cannot access org.graalvm.polyglot.proxy.ProxyObject
bad class file: /root/.m2/repository/org/graalvm/sdk/graal-sdk/22.1.0.1/graal-sdk-22.1.0.1.jar(org/graalvm/polyglot/proxy/ProxyObject.class)
class file has wrong version 55.0, should be 52.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
[INFO] 1 error
what does everyone think - is it time to move to Java 11 ? cc @packleader
if I recall correctly there's some properties in the Config that can be function (e.g. afterFeature etc.) and I think that's why that PR was needed when sharing context (probably sharing between background scenario and each scenario of a Dynamic Scenario Outline in which background is executed independently and then shared with each execution of the scenarios).
In theory the last time I followed some of your links of latest on Graal all of this rehydration code should go away anyways but that'll probably be quite a risky refactor without lots of people testing it
@edwardsph I think you will be able to use the latest version of graal without any issues by adding these to your pom.xml and over-ride. Karate never shades these JARs anyway and the latest version allows you to over-ride any JAR, even the ones shaded in the "fatjar". do confirm !
<!--
<graal.version>22.1.0.1</graal.version>
-->
<dependency>
<groupId>org.graalvm.js</groupId>
<artifactId>js-scriptengine</artifactId>
<version>${graal.version}</version>
</dependency>
<dependency>
<groupId>org.graalvm.js</groupId>
<artifactId>js</artifactId>
<version>${graal.version}</version>
<scope>runtime</scope>
</dependency>
I'm in favor of going all-in with Java 11. Lot's of other mainstream projects are dropping support for Java 8 (eg. Sonarqube, GraalVM), so we'd be in good company. And if we try to keep support for Java 8, we would likely miss out on newer versions of such libraries. Karate 1.2.0 was a solid release, so devs that don't want to move to Java 8 will still be able to benefit from Karate.
We might want to think about how we deal with any critical bugs that get reported against Karate 1.2.0. If we only apply the fixes to develop for 1.3.0, then our users won't have access to those fixes unless they move to Java 11. We may need a model where we branch from the 1.2.0 tag and apply the fixes for any critical bugs. That way we can publish 1.2.1, etc. with the bugfixes available to teams that are still on Java 8.
@packleader thanks ! I agree with your assessment, and 1.2.0 is a pretty solid release. I think creating a branch for 1.2.0 is the way to go. for now, I intend to re-write some of the code in ScenarioEngine on develop itself, just hope I get time this month
all: 1.2.1.RC2 should be in maven central now using graal-js 22.0
It hasn't arrived there yet but I look forward to testing it out when it does. I was already using the direct dependencies in the pom as you suggest above but still had issues with that. Hopefully the other changes you have made will resolve those. Thanks.
Good news - this is all working for me:
<quarkus.version>2.9.2.Final</quarkus.version>
<karate.version>1.2.1.RC2</karate.version>
<graal.version>22.0.0.2</graal.version>
I tried this with Graal 22.1.0.1 but the process just locks up but this could be an issue with Quarkus. For now, this is a really helpful step forwards as the latest Karate and Quarkus rely on 22.0.0.2.
@edwardsph thanks for the update !
Yes indeed, it locks up with graal 22.1.x., same goes with 22.2.0, so cannot manually override in the pom.xml.
I ran into some weird memory leak issue, and after a bit of googling ran into this: https://github.com/oracle/graaljs/issues/607
Any chance of getting karate upgraded to graal 22.1.x or higher? (22.2.0 is out already....)
@mattkoss contributions welcome ;)
tagging #1883 as a related issue for future reference
considering this fixed. #2083 will track the move to JDK 11. 22.0.0.2 is the last Graal version on JDK 8 and Karate 1.3.0 will be locked to that
What are the context sharing changes? I think (without much digging) that variables defined in karate-config.js are not accessible but someone in karate-base.js are.
there are no context sharing changes.
There's a change in behavior which I think goes back to a previous Graal/Nashorn behavior (before we started fixing all context switching). E.g. below:
karate-config.js
function fn() {
var config = {};
config.utils = karate.call('classpath:com/intuit/karate/core/jscall/utils.feature');
return config;
}
utils.feature
Feature:
Scenario:
* def sayHello = function() { return 'hello world!' }
* def useExistingFunction =
"""
function() {
return sayHello();
}
"""
Before the latest changes to Graal 22.0 we'd call the other function by using utils.sayHello() and now we should call it by using sayHello(), otherwise we get an error like 'utils reference not found' or similar. I am fairly certain this is just going back to how Nashorn used to work and I do prefer it.
Don't think it's a problem but rather something that should be part of release notes as a breaking change.
not sure it is a breaking change, but it is "better" support for JS. anyway this is what RC releases are for. thanks !
No other reports of impacts with 1.2.1.RC2 @ptrthomas
After upgrading to 1.3.0.RC2 - I see this still uses Graal 22.0.x so the memory leak is still there. I tried to see if I can resolve issues after override to 22.1.x - but this seems quite tricky for someone with my skills :)
Am I right in thinking that this upgrade is a major job, @ptrthomas?
it may not be, but I hope you can wait approx 6 weeks. this is the issue you can watch: https://github.com/karatelabs/karate/issues/2083
but @mattkoss if you see comment from @edwardsph - I think you can use Java 11 and force a new version of Graal and things may just work. here is a pom where I was able to do this: https://github.com/ptrthomas/karate-oas-demo/blob/ac08c940888c9eca652eed3725320eff0352ad21/pom.xml
Tried this, but still getting:
<<<
[ERROR] execute Time elapsed: 1.334 s <<< ERROR!
org.graalvm.polyglot.PolyglotException: java.lang.NoClassDefFoundError: com.oracle.truffle.js.lang.JavaScriptLanguage (initialization failure)
In case it helps, my project uses Graal 22.1.0 with Karate 1.3.0.RC2: https://github.com/solid-contrib/conformance-test-harness/blob/main/pom.xml
Unfortunately still getting the above exception, I wonder how this works for you, @edwardsph. JavaScriptLanguage is there in the graal js jar, but it fails to be initialised, getting errors like:
org.graalvm.polyglot.PolyglotException: java.lang.NoClassDefFoundError: com.oracle.truffle.js.lang.JavaScriptLanguage (initialization failure)
at java.base/java.lang.J9VMInternals.initializationAlreadyFailed(J9VMInternals.java:136)
at com.oracle.truffle.js.lang.JavaScriptLanguageProvider.create(JavaScriptLanguageProvider.java:51)
at com.oracle.truffle.polyglot.LanguageCache.loadLanguage(LanguageCache.java:548)
at com.oracle.truffle.polyglot.PolyglotLanguageInstance.<init>(PolyglotLanguageInstance.java:100)
at com.oracle.truffle.polyglot.PolyglotLanguage.getInitLanguage(PolyglotLanguage.java:152)
at com.oracle.truffle.polyglot.PolyglotLanguage.ensureInitialized(PolyglotLanguage.java:142)
at com.oracle.truffle.polyglot.PolyglotLanguage.getOptionsInternal(PolyglotLanguage.java:134)
at com.oracle.truffle.polyglot.PolyglotLanguage.getOptionValues(PolyglotLanguage.java:202)
at com.oracle.truffle.polyglot.PolyglotContextConfig.<init>(PolyglotContextConfig.java:266)
at com.oracle.truffle.polyglot.PolyglotEngineImpl.createContext(PolyglotEngineImpl.java:1745)
at com.oracle.truffle.polyglot.PolyglotEngineDispatch.createContext(PolyglotEngineDispatch.java:159)
at org.graalvm.polyglot.Context$Builder.build(Context.java:1832)
at com.intuit.karate.graal.JsEngine.createContext(JsEngine.java:79)
at com.intuit.karate.graal.JsEngine.access$000(JsEngine.java:47)
at com.intuit.karate.graal.JsEngine$1.initialValue(JsEngine.java:63)
at com.intuit.karate.graal.JsEngine$1.initialValue(JsEngine.java:60)
at java.base/java.lang.ThreadLocal.setInitialValue(ThreadLocal.java:195)
at java.base/java.lang.ThreadLocal.get(ThreadLocal.java:172)
at com.intuit.karate.graal.JsEngine.local(JsEngine.java:99)
at com.intuit.karate.report.Report$Builder.build(Report.java:122)
at com.intuit.karate.report.SuiteReports.timelineReport(SuiteReports.java:62)
at com.intuit.karate.Results.<init>(Results.java:97)
at com.intuit.karate.Results.of(Results.java:57)
at com.intuit.karate.Suite.buildResults(Suite.java:373)
at com.intuit.karate.Runner$Builder.parallel(Runner.java:501)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor$$Lambda$144/0000000000000000.apply(Unknown Source)
at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall$$Lambda$145/0000000000000000.apply(Unknown Source)
at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
at org.junit.jupiter.engine.execution.ExecutableInvoker$$Lambda$356/0000000000000000.apply(Unknown Source)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:210)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor$$Lambda$642/0000000000000000.execute(Unknown Source)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:206)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:131)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:65)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$219/0000000000000000.execute(Unknown Source)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
at org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$218/0000000000000000.invoke(Unknown Source)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
at org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$217/0000000000000000.execute(Unknown Source)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService$$Lambda$223/0000000000000000.accept(Unknown Source)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143)
at org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$219/0000000000000000.execute(Unknown Source)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
at org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$218/0000000000000000.invoke(Unknown Source)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
at org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$217/0000000000000000.execute(Unknown Source)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService$$Lambda$223/0000000000000000.accept(Unknown Source)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143)
at org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$219/0000000000000000.execute(Unknown Source)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
at org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$218/0000000000000000.invoke(Unknown Source)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
at org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$217/0000000000000000.execute(Unknown Source)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:108)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator$$Lambda$174/0000000000000000.accept(Unknown Source)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:96)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:75)
at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:57)
at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
Caused by: java.lang.RuntimeException: failed to get hash field offset
at com.oracle.truffle.api.strings.TStringUnsafe.getStringDeclaredField(TStringUnsafe.java:90)
at com.oracle.truffle.api.strings.TStringUnsafe.<clinit>(TStringUnsafe.java:79)
at com.oracle.truffle.api.strings.TStringInternalNodes$FromJavaStringUTF16Node.doNonEmpty(TStringInternalNodes.java:1394)
at com.oracle.truffle.api.strings.TStringInternalNodesFactory$FromJavaStringUTF16NodeGen$Uncached.execute(TStringInternalNodesFactory.java:3919)
at com.oracle.truffle.api.strings.TruffleString$FromJavaStringNode.doUTF16(TruffleString.java:1922)
at com.oracle.truffle.api.strings.TruffleStringFactory$FromJavaStringNodeGen$Uncached.execute(TruffleStringFactory.java:723)
at com.oracle.truffle.api.strings.TruffleString$FromJavaStringNode.execute(TruffleString.java:1900)
at com.oracle.truffle.api.strings.TruffleString.fromJavaStringUncached(TruffleString.java:1955)
at com.oracle.js.parser.ParserStrings.constant(ParserStrings.java:52)
at com.oracle.js.parser.ParserStrings.<clinit>(ParserStrings.java:49)
at com.oracle.truffle.js.runtime.JSRealm.<clinit>(JSRealm.java:211)
at com.oracle.truffle.js.runtime.JSContextOptions.<clinit>(JSContextOptions.java:457)
at com.oracle.truffle.js.lang.JavaScriptLanguage.<clinit>(JavaScriptLanguage.java:182)
at com.oracle.truffle.js.lang.JavaScriptLanguageProvider.create(JavaScriptLanguageProvider.java:51)
at com.oracle.truffle.polyglot.LanguageCache.loadLanguage(LanguageCache.java:548)
at com.oracle.truffle.polyglot.PolyglotLanguageInstance.<init>(PolyglotLanguageInstance.java:100)
at com.oracle.truffle.polyglot.PolyglotLanguage.getInitLanguage(PolyglotLanguage.java:152)
at com.oracle.truffle.polyglot.PolyglotLanguage.ensureInitialized(PolyglotLanguage.java:142)
at com.oracle.truffle.polyglot.PolyglotLanguage.getOptionsInternal(PolyglotLanguage.java:134)
at com.oracle.truffle.polyglot.PolyglotLanguage.getOptionValues(PolyglotLanguage.java:202)
at com.oracle.truffle.polyglot.PolyglotContextConfig.<init>(PolyglotContextConfig.java:266)
at com.oracle.truffle.polyglot.PolyglotEngineImpl.createContext(PolyglotEngineImpl.java:1745)
at com.oracle.truffle.polyglot.PolyglotEngineDispatch.createContext(PolyglotEngineDispatch.java:159)
at org.graalvm.polyglot.Context$Builder.build(Context.java:1832)
at com.intuit.karate.graal.JsEngine.createContext(JsEngine.java:79)
at com.intuit.karate.graal.JsEngine.access$000(JsEngine.java:47)
at com.intuit.karate.graal.JsEngine$1.initialValue(JsEngine.java:63)
at com.intuit.karate.graal.JsEngine$1.initialValue(JsEngine.java:60)
at java.base/java.lang.ThreadLocal.setInitialValue(ThreadLocal.java:195)
at java.base/java.lang.ThreadLocal.get(ThreadLocal.java:172)
at com.intuit.karate.graal.JsEngine.local(JsEngine.java:99)
at com.intuit.karate.core.ScenarioEngine.init(ScenarioEngine.java:1042)
at com.intuit.karate.core.ScenarioIterator.tryAdvance(ScenarioIterator.java:99)
at com.intuit.karate.core.ScenarioIterator.tryAdvance(ScenarioIterator.java:88)
at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.lambda$initPartialTraversalState$0(StreamSpliterators.java:294)
at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator$$Lambda$287/0000000000000000.getAsBoolean(Unknown Source)
at java.base/java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.fillBuffer(StreamSpliterators.java:206)
at java.base/java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.doAdvance(StreamSpliterators.java:161)
at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.tryAdvance(StreamSpliterators.java:300)
at java.base/java.util.Spliterators$1Adapter.hasNext(Spliterators.java:681)
at com.intuit.karate.core.ParallelProcessor.execute(ParallelProcessor.java:69)
at com.intuit.karate.core.FeatureRuntime.run(FeatureRuntime.java:170)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:836)
Caused by: java.lang.NoSuchFieldException: hash
at java.base/java.lang.Class.getDeclaredFieldImpl(Native Method)
at java.base/java.lang.Class.getDeclaredField(Class.java:898)
at com.oracle.truffle.api.strings.TStringUnsafe.getStringDeclaredField(TStringUnsafe.java:88)
... 47 more
Caused by: Attached Guest Language Frames (0)
Internal GraalVM error, please report at https://github.com/oracle/graal/issues/.
Funny enough, after refactoring to support 1.3.0.RC2, also memory usage has improved, but it still falls over after about 6000 tests. Will wait for the graal upgrade and revisit.
@mattkoss sure. do consider creating a way to replicate the problem you are referring to, perhaps this thread will give you some pointers: https://github.com/karatelabs/karate/issues/1685 - and there's some code you may be able to use as a base: https://github.com/karatelabs/karate/tree/master/examples/profiling-test
There's a change in behavior which I think goes back to a previous Graal/Nashorn behavior (before we started fixing all context switching). E.g. below:
karate-config.js
function fn() { var config = {}; config.utils = karate.call('classpath:com/intuit/karate/core/jscall/utils.feature'); return config; }utils.feature
Feature: Scenario: * def sayHello = function() { return 'hello world!' } * def useExistingFunction = """ function() { return sayHello(); } """Before the latest changes to Graal 22.0 we'd call the other function by using
utils.sayHello()and now we should call it by usingsayHello(), otherwise we get an error like 'utils reference not found' or similar. I am fairly certain this is just going back to how Nashorn used to work and I do prefer it.Don't think it's a problem but rather something that should be part of release notes as a breaking change.
@ptrthomas another variation of this that is a breaking change .. if you have help JS functions that access driver methods, the driver doesn't appear to be available anymore in that JS context. Didn't caught this earlier. Do you have any suggestions that don't involve passing the driver variable on all these functions?
@ptrthomas another variation of this that is a breaking change .. if you have help JS functions that access
drivermethods, thedriverdoesn't appear to be available anymore in that JS context. Didn't caught this earlier. Do you have any suggestions that don't involve passing thedrivervariable on all these functions?
This PR reproduces the issue to review/discuss https://github.com/karatelabs/karate/pull/2160 . The additional logging was something I was planning on opening to get some extra details for another issue, unrelated with the actual issue but thought I'd include it too.