erlang_v8 icon indicating copy to clipboard operation
erlang_v8 copied to clipboard

Cannot load JavaScript file over 130KB

Open piglovesyou opened this issue 7 years ago • 6 comments

make tests finishes without error. But when I put meaningless lines in test/js/variables.js to make its size larger, the test was failed with the following log.

[pig@localhost erlang_v8]$ ls -lh test/js/variables.js; make tests
-rw-r--r-- 1 pig pig 130K Feb 25 11:32 test/js/variables.js
make[1]: Entering directory '/home/pig/git/erlang_v8/deps/jsx'
make[1]: Leaving directory '/home/pig/git/erlang_v8/deps/jsx'
make[1]: Entering directory '/home/pig/git/erlang_v8/deps/ct_helper'
make[1]: Leaving directory '/home/pig/git/erlang_v8/deps/ct_helper'
 GEN    test-dir
make -C /home/pig/git/erlang_v8/c_src
make[1]: Entering directory '/home/pig/git/erlang_v8/c_src'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/pig/git/erlang_v8/c_src'
 GEN    ct


Common Test v1.13 starting (cwd is /home/pig/git/erlang_v8)



CWD set to: "/home/pig/git/erlang_v8/logs/[email protected]_11.35.48"

TEST INFO: 1 test(s), 14 case(s) in 1 suite(s)

Testing git.erlang_v8.port_SUITE: Starting test, 14 test cases

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
port_SUITE:init_from_file failed on line 220
Reason: {badmatch,{error,vm_unresponsive}}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Testing git.erlang_v8.port_SUITE: *** FAILED test case 9 of 14 ***
Testing git.erlang_v8.port_SUITE: TEST COMPLETE, 13 ok, 1 failed of 14 test cases

Updating /home/pig/git/erlang_v8/logs/index.html ... done
Updating /home/pig/git/erlang_v8/logs/all_runs.html ... done

make: *** [erlang.mk:6145: ct] Error 1

Is there any way to control the limitation?

piglovesyou avatar Feb 25 '17 11:02 piglovesyou

Looks like the port process is still processing data when the request to create a context arrives. Can you please attach your variables.js?

Thank you.

strange avatar Mar 01 '17 10:03 strange

Sure https://gist.github.com/piglovesyou/bbe4b82e80ff959fae67f07ddd33d67e

piglovesyou avatar Mar 01 '17 12:03 piglovesyou

Thank you!

strange avatar Mar 02 '17 12:03 strange

Ok, the limit is 128kb as defined by MAX_ARG_STRLEN in binfmts.h. It's not a bug in erlang_v8 but rather a limitation in the kernel. It's not feasible to work around that limit.

The quick-fix is to generate an error for files larger than 128kb (you can, however, add multiple 128kb files until you reach another limit). Something that would solve this is to just send paths to the C-process and read the files from there. I've been considering this for different reasons for a while.

Can you work around this in the meantime (split file into several smaller files)?

strange avatar Mar 02 '17 22:03 strange

@strange Thank you for your support. Because I compile JavaScript from Node modules, it's hard to determine size of each scripts. I'd wanted to try React.js server side rendering in Phoenix app with erlang_v8, but I think I need to consider how to do that again.

Or if we could pass a file path instead of its content to V8 process and let it read, perhaps.. not sure.

piglovesyou avatar Mar 04 '17 06:03 piglovesyou

Give me a little time and I'll benchmark some stuff.

On Sat, 4 Mar 2017 at 07:44, piglovesyou [email protected] wrote:

@strange https://github.com/strange Thank you for your support. Because I compile JavaScript from Node modules, it's hard to determine size of each scripts. I'd wanted to try React.js server side rendering in Phoenix app with erlang_v8, but I think I need to consider how to do that again. Thanks in advance.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/strange/erlang_v8/issues/5#issuecomment-284132502, or mute the thread https://github.com/notifications/unsubscribe-auth/AADvSQrcUmlULgOk6ELX3IvDKZOm6KG5ks5riQhigaJpZM4ML_Po .

strange avatar Mar 04 '17 11:03 strange