fastr icon indicating copy to clipboard operation
fastr copied to clipboard

internal error in rnorm

Open rsettlage opened this issue 4 years ago • 7 comments

docker run -it ghcr.io/graalvm/graalvm-ce:21.0.0 bash
gu install R
> n<-2^14
> n^2
[1] 268435456
> M<-rnorm(n^2)
An internal error occurred.
Please report an issue at https://github.com/oracle/fastr including the commands. You can rerun FastR with --R.PrintErrorStacktracesToFile=true to turn on internal errors logging. Please attach the log file to the issue if possible.

rsettlage avatar Feb 22 '21 17:02 rsettlage

Hello,

can you re-run with --R.PrintErrorStacktracesToFile=true and check what exception this produces (it will be in the log file). My guess would be that it is out of memory error and you'll need to give your application/container more memory (use, e.g., --vm.Xmx4g).

steve-s avatar Feb 22 '21 19:02 steve-s

OK, did that, perhaps I didn't do it quite right.

Caused by: java.lang.OutOfMemoryError: Java heap space at com.oracle.truffle.r.library.stats.RandFunctionsNodes$RandFunctionDoubleExecutorNode.cached(RandFunctionsNodes.java:273) at com.oracle.truffle.r.library.stats.RandFunctionsNodesFactory$RandFunctionDoubleExecutorNodeGen.executeAndSpecialize(RandFunctionsNodesFactory.java:592) at com.oracle.truffle.r.library.stats.RandFunctionsNodesFactory$RandFunctionDoubleExecutorNodeGen.execute(RandFunctionsNodesFactory.java:547) at com.oracle.truffle.r.library.stats.RandFunctionsNodes$RandFunctionExecutorBase.evaluateWithCached(RandFunctionsNodes.java:158) at com.oracle.truffle.r.library.stats.RandFunctionsNodesFactory$RandFunctionExecutorBaseNodeGen.executeAndSpecialize(RandFunctionsNodesFactory.java:318) at com.oracle.truffle.r.library.stats.RandFunctionsNodesFactory$RandFunctionExecutorBaseNodeGen.execute(RandFunctionsNodesFactory.java:281) at com.oracle.truffle.r.library.stats.RandFunctionsNodes$RandFunction2Node.evaluate(RandFunctionsNodes.java:360) at com.oracle.truffle.r.library.stats.RandFunctionsNodesFactory$RandFunction2NodeGen.executeAndSpecialize(RandFunctionsNodesFactory.java:808) at com.oracle.truffle.r.library.stats.RandFunctionsNodesFactory$RandFunction2NodeGen.execute(RandFunctionsNodesFactory.java:777) at com.oracle.truffle.r.nodes.builtin.RExternalBuiltinNode$Arg3.call(RExternalBuiltinNode.java:108) at com.oracle.truffle.r.nodes.builtin.RExternalBuiltinNode.call(RExternalBuiltinNode.java:40) at com.oracle.truffle.r.nodes.builtin.base.foreign.CallAndExternalFunctions$Dot.doExternalBuiltinSymbolInfo(CallAndExternalFunctions.java:319) at com.oracle.truffle.r.nodes.builtin.base.foreign.CallAndExternalFunctionsFactory$DotCallNodeGen.executeAndSpecialize(CallAndExternalFunctionsFactory.java:682) at com.oracle.truffle.r.nodes.builtin.base.foreign.CallAndExternalFunctionsFactory$DotCallNodeGen.execute(CallAndExternalFunctionsFactory.java:637) at com.oracle.truffle.r.nodes.builtin.RBuiltinNode$Arg3.call(RBuiltinNode.java:205) at com.oracle.truffle.r.nodes.function.RCallNode$BuiltinCallNode.execute(RCallNode.java:1165) at com.oracle.truffle.r.nodes.function.RCallNode$FunctionDispatch.dispatch(RCallNode.java:921) at com.oracle.truffle.r.nodes.function.RCallNodeGen$FunctionDispatchNodeGen.executeAndSpecialize(RCallNodeGen.java:749) at com.oracle.truffle.r.nodes.function.RCallNodeGen$FunctionDispatchNodeGen.execute(RCallNodeGen.java:713) at com.oracle.truffle.r.nodes.function.RCallNode.call(RCallNode.java:296) at com.oracle.truffle.r.nodes.function.RCallNodeGen.executeAndSpecialize(RCallNodeGen.java:236) at com.oracle.truffle.r.nodes.function.RCallNodeGen.execute(RCallNodeGen.java:210) at com.oracle.truffle.r.runtime.nodes.RNode.visibleExecute(RNode.java:74) at com.oracle.truffle.r.nodes.function.FunctionBodyNode.visibleExecute(FunctionBodyNode.java:67) at com.oracle.truffle.r.nodes.function.FunctionDefinitionNode.execute(FunctionDefinitionNode.java:289) at jdk.internal.vm.compiler/org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.executeRootNode(OptimizedCallTarget.java:591) at jdk.internal.vm.compiler/org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.profiledPERoot(OptimizedCallTarget.java:562) at jdk.internal.vm.compiler/org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:512) at jdk.internal.vm.compiler/org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:496) at jdk.internal.vm.compiler/org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:459) at jdk.internal.vm.compiler/org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:71) at com.oracle.truffle.r.nodes.function.call.CallRFunctionNode.execute(CallRFunctionNode.java:63) Caused by: Attached Guest Language Frames (3)

Frame(d=1): rnorm (called as: rnorm(n^2)) Frame(d=0): (called as: )

with frame slot contents:

Frame(d=1): rnorm (called as: rnorm(n^2)) n = [4, org.graalvm.compiler.truffle.runtime.FrameWithoutBoxing@577de8df, expr=WrapArgumentNode@57762707, 2.68435456E8] mean = [3, org.graalvm.compiler.truffle.runtime.FrameWithoutBoxing@21acff7a, expr=ConstantDoubleScalarNode@448acb72, 0.0] sd = [3, org.graalvm.compiler.truffle.runtime.FrameWithoutBoxing@21acff7a, expr=ConstantDoubleScalarNode@4670bb3d, 1.0] Visibility = true Frame(d=0): (called as: ) FunctionEvalCallNode-argsIdentifier = null FunctionEvalCallNode-funIdentifier = null Visibility = true .Random.seed = active binding RExplicitCall-argsIdentifier = null n = 16384.0

rsettlage avatar Feb 22 '21 20:02 rsettlage

Caused by: java.lang.OutOfMemoryError

indeed not enough memory. I'll have to give the container and possibly also the JVM (via --vm.Xmx{Size}) more memory.

steve-s avatar Feb 22 '21 20:02 steve-s

Just to make sure,, I added this to the container run command -e -vm.Xmx{Size}

rsettlage avatar Feb 22 '21 20:02 rsettlage

You need to pass it to the R command, example:

R --vm.Xmx8g

will set the max heap size to 8GB, which should be enough. Now the question is if you container will have 8GB of memory available, but then that's an issue of properly configuring the container/Docker.

steve-s avatar Mar 03 '21 12:03 steve-s

Ah, thanks. Do you have a suggestion for the docker side? I am doing this:

docker run -it --oom-kill-disable -m 18g ghcr.io/graalvm/graalvm-ce:21.0.0 bash

and still getting the killed message for the process inside the container. At least it isn't erring as before!

rsettlage avatar Mar 03 '21 14:03 rsettlage

This documentation: https://docs.docker.com/config/containers/resource_constraints tells me that you probably need something like

docker run --memory=8g -it --oom-kill-disable -m 18g ghcr.io/graalvm/graalvm-ce:21.0.0 bash

and then still run FastR with the --vm.Xmx8g flag. But I am not an expert on Docker :-)

steve-s avatar Mar 03 '21 17:03 steve-s