You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was checking what all resource restrictions have been set for WASM code execution. All the tests have been done locally with the latest master 2c0005d
I created a smart stream filter which never really exits:
#[smartstream(filter)]pubfnfilter(record:&Record) -> bool{let str_result = std::str::from_utf8(record.value.as_ref());let string = match str_result {Ok(s) => s,
_ => returnfalse,};letmut c = 0;loop{
c += 1;}eprintln!("{}", c);
string.contains('a')}
I ran the consumer on my terminal which just hung till I cancelled. The CPU usage shot to 70% (from 30%). I kept it running for few minutes, assuming if there were any max time set on these operations. Then I manually cancelled.
Also tried code with infinite recursion, this also behaves like previous code and CPU usage increased:
// omitted for brevity// never ending recursionfnfact(x:u32) -> u32{if x == 0{1}else{fact(x)}}eprintln!("{:?}", fact(5));
string.contains('a')}
From our discussion from Discord, @sehz suggested setting consume_fuel to solve these issues.
Reporting for the sake of completeness, I am mentioning other things I tried. In the following, WASM engine gave error and consumer returned immediately:
code with sleep statement
code with process.exit
I wanted to test for memory limits, but could not come up with rust code which grew in memory. Related issues in wastime (#1872, #2273)
I was checking what all resource restrictions have been set for WASM code execution. All the tests have been done locally with the latest master
2c0005d
I created a smart stream filter which never really exits:
I ran the consumer on my terminal which just hung till I cancelled. The CPU usage shot to 70% (from 30%). I kept it running for few minutes, assuming if there were any max time set on these operations. Then I manually cancelled.
Also tried code with infinite recursion, this also behaves like previous code and CPU usage increased:
From our discussion from Discord, @sehz suggested setting consume_fuel to solve these issues.
Reporting for the sake of completeness, I am mentioning other things I tried. In the following, WASM engine gave error and consumer returned immediately:
I wanted to test for memory limits, but could not come up with rust code which grew in memory. Related issues in wastime (#1872, #2273)
my code:
But this was handled properly by the SPU with the following error:
The text was updated successfully, but these errors were encountered: