Uh oh!
There was an error while loading. Please reload this page.
doc, test: document and test vm timeout escapes - #23743
Conversation
jasnell
commented
Oct 18, 2018
There was a problem hiding this comment.
Nit: how about caching the result instead of recomputing it?
vsemozhetbyt
commented
Oct 19, 2018
I've run the example in all supported versions, last nightly and canary and every time I've got: Error: Script execution timed[ out after 5ms]and then the node exited and no infinite loops happened. Would it be confusing for a reader that would test the example? |
jasnell
commented
Oct 19, 2018
@vsemozhetbyt ... I assume you're copying the example to a file then running it? If so, the unhandled error crashes the process. I've removed the second call to |
vsemozhetbyt
commented
Oct 19, 2018
Yes, I often test examples in file scripts) |
TimothyGu
left a comment
There was a problem hiding this comment.
In the documentation, I would additionally drive home the fact that the timeout is not a security sandboxing mechanism, and that a more comprehensive solution could be running the untrusted code in a complete separate process. Overall looks good.
jasnell
commented
Oct 19, 2018
@TimothyGu ... there is already a warning in there for that, I believe. Doesn't mean it can't be made better but let's save that for a different PR. |
jasnell
commented
Oct 19, 2018
Please 👍 to fast-track |
jasnell
commented
Oct 23, 2018
jasnell
commented
Oct 23, 2018
Unfortunately the new tests here are flaky. Will have to investigate |
ac777ae to
5066c53Comparejasnell
commented
Oct 23, 2018
Using `process.nextTick()`, `Promise`, or `queueMicrotask()`, it is possible to escape the `timeout` set when running code with `vm.runInContext()`, `vm.runInThisContext()`, and `vm.runInNewContext()`. This documents the issue and adds three known_issues tests. Refs: nodejs#3020
These are known issues that can be flaky on certain platforms because they rely entirely on timing differences.
5066c53 to
47a2cb5Comparejasnell
commented
Oct 24, 2018
Unfortunately, the known_issue tests appear to be inherently flaky due to the reliance on timing differences for them to fail. Marking them flaky in a separate commit. Not sure if there's a way to make them fail more reliably but having the known_issue tests in there, flaky or otherwise, is still generally a good idea. New CI: https://ci.nodejs.org/job/node-test-pull-request/18117/ |
Using `process.nextTick()`, `Promise`, or `queueMicrotask()`, it is possible to escape the `timeout` set when running code with `vm.runInContext()`, `vm.runInThisContext()`, and `vm.runInNewContext()`. This documents the issue and adds three known_issues tests. Refs: #3020 PR-URL: #23743 Refs: #3020 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
jasnell
commented
Oct 24, 2018
Using `process.nextTick()`, `Promise`, or `queueMicrotask()`, it is possible to escape the `timeout` set when running code with `vm.runInContext()`, `vm.runInThisContext()`, and `vm.runInNewContext()`. This documents the issue and adds three known_issues tests. Refs: #3020 PR-URL: #23743 Refs: #3020 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Trott
commented
Nov 6, 2018
Looks like the test may be flaky...https://ci.nodejs.org/job/node-test-commit-smartos/21423/nodes=smartos16-64/console I'll open an issue. |
will hold off on landing in LTS until it is clearly not flaky |
Trott
commented
Nov 27, 2018
Trott
commented
Nov 27, 2018
test-vm-timeout-escape-promise is still marked as flaky in the status file. Not sure how often it actually flakes, though. |
Using `process.nextTick()` or `Promise`, it is possible to escape the `timeout` set when running code with `vm.runInContext()`, `vm.runInThisContext()`, and `vm.runInNewContext()`. This documents the issue and adds two known_issues tests. Refs: #3020 PR-URL: #23743 Refs: #3020 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Using `process.nextTick()` or `Promise`, it is possible to escape the `timeout` set when running code with `vm.runInContext()`, `vm.runInThisContext()`, and `vm.runInNewContext()`. This documents the issue and adds two known_issues tests. Refs: #3020 PR-URL: #23743 Refs: #3020 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Finally getting back to this one ;-)
Using
process.nextTick(),Promise, orqueueMicrotask(), itis possible to escape the
timeoutset when running code withvm.runInContext(),vm.runInThisContext(), andvm.runInNewContext().This documents the issue and adds three known_issues tests.
Refs: #3020
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes