Skip to content

console.log crashes when handling a null argument #1812

@darvld

Description

@darvld

Expected Behavior

Calling console.log(null) should print the string null

Actual Behaviour

Crashes with java.lang.NullPointerException: Parameter specified as non-null is null: method. This suggests some incorrect handling of log arguments in the slf4j bridge.

Stacktrace

java.lang.NullPointerException: Parameter specified as non-null is null: method kotlin.collections.ArraysKt___ArraysKt.toList, parameter
at kotlin.collections.ArraysKt___ArraysKt.toList(_Arrays.kt)
at elide.runtime.gvm.internals.intrinsics.js.console.ConsoleIntrinsic.handleLog(ConsoleIntrinsic.kt:197)
at elide.runtime.gvm.internals.intrinsics.js.console.ConsoleIntrinsic.log(ConsoleIntrinsic.kt:202)
at [email protected]/java.lang.reflect.Method.invoke(Method.java:565)
at org.graalvm.truffle/com.oracle.truffle.host.HostMethodDesc$SingleMethod$MethodReflectImpl.reflectInvoke(HostMethodDesc.java:306)
at org.graalvm.truffle/com.oracle.truffle.host.HostMethodDesc$SingleMethod$MethodReflectImpl.invoke(HostMethodDesc.java:291)
at org.graalvm.truffle/com.oracle.truffle.host.GuestToHostCodeCache$GuestToHostInvokeReflect.executeImpl(GuestToHostCodeCache.java:110)
at org.graalvm.truffle/com.oracle.truffle.host.GuestToHostRootNode.execute(GuestToHostRootNode.java:80)
at org.graalvm.truffle.runtime/com.oracle.truffle.runtime.OptimizedCallTarget.executeRootNode(OptimizedCallTarget.java:830)
at org.graalvm.truffle.runtime/com.oracle.truffle.runtime.OptimizedCallTarget.callInlined(OptimizedCallTarget.java:626)
at org.graalvm.truffle.runtime/com.oracle.truffle.runtime.OptimizedRuntimeSupport.callInlined(OptimizedRuntimeSupport.java:292)
at org.graalvm.truffle/com.oracle.truffle.host.GuestToHostRootNode.guestToHostCall(GuestToHostRootNode.java:102)
at org.graalvm.truffle/com.oracle.truffle.host.HostMethodDesc$SingleMethod$ReflectBase.invokeGuestToHost(HostMethodDesc.java:260)
at org.graalvm.truffle/com.oracle.truffle.host.HostExecuteNode.doInvoke(HostExecuteNode.java:906)
at org.graalvm.truffle/com.oracle.truffle.host.HostExecuteNode.doVarArgs(HostExecuteNode.java:208)
at org.graalvm.truffle/com.oracle.truffle.host.HostExecuteNodeGen$Inlined.executeAndSpecialize(HostExecuteNodeGen.java:393)
at org.graalvm.truffle/com.oracle.truffle.host.HostExecuteNodeGen$Inlined.execute(HostExecuteNodeGen.java:317)
at org.graalvm.truffle/com.oracle.truffle.host.HostObject.invokeMember(HostObject.java:465)
at org.graalvm.truffle/com.oracle.truffle.host.HostObjectGen$InteropLibraryExports$Cached.invokeMemberNode_AndSpecialize(HostObjectGen.java:7007)
at org.graalvm.truffle/com.oracle.truffle.host.HostObjectGen$InteropLibraryExports$Cached.invokeMember(HostObjectGen.java:6993)
at org.graalvm.truffle/com.oracle.truffle.api.interop.InteropLibraryGen$CachedDispatch.invokeMember(InteropLibraryGen.java:8497)
at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$ForeignInvokeNode.executeCall(JSFunctionCallNode.java:1548)
at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeAndSpecialize(JSFunctionCallNode.java:308)
at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeCall(JSFunctionCallNode.java:253)
at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$InvokeNode.execute(JSFunctionCallNode.java:723)
at com.oracle.truffle.js.nodes.JavaScriptNodeWrapper.execute(JavaScriptNodeWrapper.java:38)
at com.oracle.truffle.js.nodes.access.JSWriteCurrentFrameSlotNodeGen.execute_generic3(JSWriteCurrentFrameSlotNodeGen.java:136)
at com.oracle.truffle.js.nodes.access.JSWriteCurrentFrameSlotNodeGen.execute(JSWriteCurrentFrameSlotNodeGen.java:67)
at com.oracle.truffle.js.nodes.access.JSWriteCurrentFrameSlotNodeGen.executeVoid(JSWriteCurrentFrameSlotNodeGen.java:319)
at com.oracle.truffle.js.nodes.binary.DualNode.execute(DualNode.java:115)
at com.oracle.truffle.js.nodes.function.FunctionBodyNode.execute(FunctionBodyNode.java:70)
at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm(FunctionRootNode.java:155)
at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:96)
at org.graalvm.truffle.runtime/com.oracle.truffle.runtime.OptimizedCallTarget.executeRootNode(OptimizedCallTarget.java:830)
at org.graalvm.truffle.runtime/com.oracle.truffle.runtime.OptimizedCallTarget.profiledPERoot(OptimizedCallTarget.java:754)
at org.graalvm.truffle.runtime/com.oracle.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:678)
at org.graalvm.truffle.runtime.svm/com.oracle.svm.truffle.api.SubstrateOptimizedCallTarget.invokeCallBoundary(SubstrateOptimizedCallTarget.java:124)
at com.oracle.truffle.enterprise.svm/com.oracle.svm.enterprise.truffle.compiler.SubstrateEnterpriseOptimizedCallTarget.a(stripped:289)
at com.oracle.truffle.enterprise.svm/com.oracle.svm.enterprise.truffle.compiler.SubstrateEnterpriseOptimizedCallTarget.doInvoke(stripped:255)
at org.graalvm.truffle.runtime/com.oracle.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:610)
at org.graalvm.truffle.runtime/com.oracle.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:94)
at com.oracle.truffle.js.lang.JavaScriptLanguage$ParsedProgramRoot.execute(JavaScriptLanguage.java:256)
at org.graalvm.truffle.runtime/com.oracle.truffle.runtime.OptimizedCallTarget.executeRootNode(OptimizedCallTarget.java:830)
at org.graalvm.truffle.runtime/com.oracle.truffle.runtime.OptimizedCallTarget.profiledPERoot(OptimizedCallTarget.java:754)
at org.graalvm.truffle.runtime/com.oracle.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:678)
at org.graalvm.truffle.runtime.svm/com.oracle.svm.truffle.api.SubstrateOptimizedCallTarget.invokeCallBoundary(SubstrateOptimizedCallTarget.java:124)
at com.oracle.truffle.enterprise.svm/com.oracle.svm.enterprise.truffle.compiler.SubstrateEnterpriseOptimizedCallTarget.a(stripped:289)
at com.oracle.truffle.enterprise.svm/com.oracle.svm.enterprise.truffle.compiler.SubstrateEnterpriseOptimizedCallTarget.doInvoke(stripped:255)
at org.graalvm.truffle.runtime/com.oracle.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:610)
at org.graalvm.truffle.runtime/com.oracle.truffle.runtime.OptimizedCallTarget.call(OptimizedCallTarget.java:573)
at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotContextImpl.eval(PolyglotContextImpl.java:1898)
at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotContextDispatch.eval(PolyglotContextDispatch.java:62)
at org.graalvm.polyglot/org.graalvm.polyglot.Context.eval(Context.java:419)
at elide.runtime.core.internals.graalvm.GraalVMContext.evaluate(GraalVMContext.kt:55)
at elide.runtime.core.PolyglotContext.evaluate(PolyglotContext.kt:183)
at elide.runtime.core.PolyglotContext.evaluate(PolyglotContext.kt:195)
at elide.tool.cli.cmd.repl.ToolShellCommand.executeOneChunk(ToolShellCommand.kt:578)
at elide.tool.cli.cmd.repl.ToolShellCommand.beginInteractiveSession$lambda$1$0(ToolShellCommand.kt:1269)
at elide.tool.cli.cmd.repl.ToolShellCommand.initCLI(ToolShellCommand.kt:724)
at elide.tool.cli.cmd.repl.ToolShellCommand.beginInteractiveSession(ToolShellCommand.kt:1253)
at elide.tool.cli.cmd.repl.ToolShellCommand.invoke$lambda$14$0(ToolShellCommand.kt:3003)
at elide.tool.cli.AbstractSubcommand.withDeferredContext(AbstractSubcommand.kt:692)
at elide.tool.cli.AbstractSubcommand.withDeferredContext$default(AbstractSubcommand.kt:685)
at elide.tool.cli.cmd.repl.ToolShellCommand.invoke(ToolShellCommand.kt:2951)
at elide.tool.cli.AbstractSubcommand$invoke$2$1.invokeSuspend(AbstractSubcommand.kt:607)
at elide.tool.cli.AbstractSubcommand$invoke$2$1.invoke(AbstractSubcommand.kt)
at elide.tool.cli.AbstractSubcommand$invoke$2$1.invoke(AbstractSubcommand.kt)
at elide.tool.cli.AbstractSubcommand.initializeToolResources(AbstractSubcommand.kt:480)
at elide.tool.cli.AbstractSubcommand.invoke-AZeniH0$suspendImpl(AbstractSubcommand.kt:605)
at elide.tool.cli.AbstractSubcommand.invoke-AZeniH0(AbstractSubcommand.kt)
at elide.tool.cli.AbstractToolCommand$call$$inlined$execute$1.invokeSuspend(AbstractToolCommand.kt:267)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:34)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:263)
at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:94)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:70)
at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:48)
at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
at elide.tool.cli.AbstractToolCommand.call(AbstractToolCommand.kt:315)
at elide.tool.cli.Elide.invoke-AZeniH0(Elide.kt:537)
at elide.tool.cli.AbstractToolCommand$call$$inlined$execute$1.invokeSuspend(AbstractToolCommand.kt:267)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:34)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:263)
at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:94)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:70)
at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:48)
at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
at elide.tool.cli.AbstractToolCommand.call(AbstractToolCommand.kt:315)
at elide.tool.cli.AbstractToolCommand.call(AbstractToolCommand.kt:59)
at picocli.CommandLine.executeUserObject(CommandLine.java:2031)
at picocli.CommandLine.access$1500(CommandLine.java:148)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2469)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2461)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2423)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2277)
at picocli.CommandLine$RunLast.execute(CommandLine.java:2425)
at picocli.CommandLine.execute(CommandLine.java:2174)
at elide.tool.cli.Elide$Companion.entry(Elide.kt:620)
at elide.tool.cli.MainKt.main(main.kt:390)
at [email protected]/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)
Suppressed: Attached Guest Language Frames (4)

Steps To Reproduce

No response

Environment Information

No response

Runtime

Native

Language

JavaScript

Example Application

No response

Version

1.0.0-beta11-rc3

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions