-
-
Notifications
You must be signed in to change notification settings - Fork 51
Open
Description
Describe the bug
The timeout setting does not terminate long running scripts.
To Reproduce
Run the following code (its the example from the readme just simplified and with a long running loop added):
use rustyscript::{Module, Runtime, RuntimeOptions, Undefined, json_args};
use std::{error::Error, time::Duration};
fn main() -> Result<(), Box<dyn Error>> {
let module = Module::new(
"test.js",
"
for(let i = 0; i < 1000000000000; i++) {}
",
);
let mut runtime = Runtime::new(RuntimeOptions {
timeout: Duration::from_millis(50),
default_entrypoint: Some("load".to_string()),
..Default::default()
})?;
let module_handle = runtime.load_module(&module)?;
runtime.call_entrypoint::<Undefined>(&module_handle, json_args!(2))?;
Ok(())
}The program runs for however long it takes to complete the loop. But shouldnt it be terminated after 50ms?
Expected behavior
Deno should be terminated after 50ms of runtime.
Additional context
Im running the currently lates version 0.12.3
Also: How should the timeout function in the first place? when the first call to runtime.call_entrypoint takes 40ms and then we call it again and it again takes 40ms. should that terminate deno or not?
Metadata
Metadata
Assignees
Labels
No labels