gf3 / sandbox

A nifty JavaScript sandbox for Node.js
ISC License
844 stars 123 forks source link

.run dies when out of memory? #28

Closed fedelebron closed 10 years ago

fedelebron commented 10 years ago

The following code terminates node with a SyntaxError:

(new Sandbox).run("var s = \"a\"; for (i = 0; i < 100; ++i) s += s; ", function() {})

The 100 may possibly be platform dependent. This is on Linux, x86_64.

sbstp commented 10 years ago

Just tested this. It does indeed work.

gf3 commented 10 years ago

So I've added a default error state to catch this. It seems the OS kills the child process and node is unable to detect proper exit data.

Thanks for the heads up!