kill actor when abusive
This commit is contained in:
12
tests/actor_memory_abuse.ce
Normal file
12
tests/actor_memory_abuse.ce
Normal file
@@ -0,0 +1,12 @@
|
||||
// Test: actor that allocates too much memory is killed
|
||||
// Parent starts a child that allocates arrays in a loop.
|
||||
// The child should be killed when it exceeds the heap memory limit.
|
||||
$start(function(event) {
|
||||
if (event.type == 'greet') {
|
||||
// child started, wait for it to die from memory abuse
|
||||
}
|
||||
if (event.type == 'disrupt') {
|
||||
print("PASS: memory abusing actor killed")
|
||||
$stop()
|
||||
}
|
||||
}, 'tests/hang_actor_memory')
|
||||
13
tests/actor_slow_killed.ce
Normal file
13
tests/actor_slow_killed.ce
Normal file
@@ -0,0 +1,13 @@
|
||||
// Test: actor with infinite loop is killed by slow timer
|
||||
// Parent starts a child that hangs forever. The child should be
|
||||
// killed by the slow timer, triggering a 'disrupt' event.
|
||||
$start(function(event) {
|
||||
if (event.type == 'greet') {
|
||||
// child started, just wait for it to die
|
||||
}
|
||||
if (event.type == 'disrupt') {
|
||||
// child was killed by the timer — success
|
||||
print("PASS: slow actor killed by timer")
|
||||
$stop()
|
||||
}
|
||||
}, 'tests/hang_actor')
|
||||
5
tests/hang_actor_memory.ce
Normal file
5
tests/hang_actor_memory.ce
Normal file
@@ -0,0 +1,5 @@
|
||||
// Actor that allocates memory until killed by memory limit
|
||||
var big = []
|
||||
while (1) {
|
||||
big[] = array(10000, 0)
|
||||
}
|
||||
Reference in New Issue
Block a user