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

Infinite loop in Promise.then hangs whole process #116

Closed
wojpawlik opened this issue Jan 12, 2018 · 4 comments
Closed

Infinite loop in Promise.then hangs whole process #116

wojpawlik opened this issue Jan 12, 2018 · 4 comments
Labels

Comments

@wojpawlik
Copy link
Contributor

wojpawlik commented Jan 12, 2018

This code disregards the timeout and hangs the process:

'use strict'

const {VM} = require('vm2')

const vm = new VM({
	timeout: 5000,
})

console.log('Runs')

vm.run('Promise.resolve(42).then(() => {while(true) {}})') // hangs the process

setImmediate(console.log, 'Will never run')

And Promise can't be easily disabled: #74.

@awiebe
Copy link

awiebe commented Jan 19, 2018

Readme.md

IMPORTANT: Timeout is not effective for NodeVM so it is not immune to while (true) {} or similar evil.

@wojpawlik
Copy link
Contributor Author

@awiebe except, I'm using VM, not NodeVM.

@patriksimek
Copy link
Owner

Unfortunately, this is another limitation of node's timeout feature - it doesn't work for asynchronous calls, even if they're running in the sandbox.

@stale
Copy link

stale bot commented Jan 27, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jan 27, 2019
@stale stale bot closed this as completed Feb 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants