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

Fail gracefully when memory limit reached #61

Open
ateucher opened this issue May 22, 2019 · 0 comments
Open

Fail gracefully when memory limit reached #61

ateucher opened this issue May 22, 2019 · 0 comments

Comments

@ateucher
Copy link

ateucher commented May 22, 2019

This is related to #33. I understand that it might be difficult to increase the available memory to a v8 context, but is there a way to fail gracefully when that limit is (expected to be) reached? Currently R aborts:

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.


Attaching package: 'testthat'

The following objects are masked from 'package:devtools':

    setup, test_file

> library(V8)
Using V8 engine 7.2.502.24
> ctx <- v8()
> foo <- matrix(seq(100000000), 100000)
> ctx$assign("foo", foo)

<--- Last few GCs --->
ti[44963:0x10e1cf000]   233285 ms: Mark-sweep 1401.7 (1407.2) -> 1401.7 (1408.2) MB, 56.0 / 0.0 ms  (  19.4 ms in 16 steps since start of marking, biggest step 19.1 ms, walltime since start of marking 78 ms) (average mu = 0.217, current mu = 0.125) allocati[44963:0x10e1cf000]   233364 ms: Mark-sweep 1403.0 (1408.2) -> 1403.0 (1409.7) MB, 27.7 / 0.0 ms  (  48.0 ms in 20 steps since start of marking, biggest step 13.3 ms, walltime since start of marking 79 ms) (average mu = 0.183, current mu = 0.145) allocati

<--- JS stacktrace --->


#
# Fatal javascript OOM in Ineffective mark-compacts near heap limit
#


 *** caught illegal operation ***
address 0x111a1f612, cause 'illegal opcode'

Traceback:
 1: context_eval(join(src), private$context)
 2: get_str_output(context_eval(join(src), private$context))
 3: this$eval(paste("var", name, "=", toJSON(value, auto_unbox = auto_unbox,     ...)))
 4: ctx$assign("foo", foo)

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection: 1
R is aborting now ...
Illegal instruction: 4

I've had a hard time trying to figure out how large an R object will be once it's been serialized into JSON in a V8 environment. Any suggestions?

Thanks!

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

1 participant