kill actor when abusive

This commit is contained in:
2026-02-17 17:34:25 -06:00
parent 2df45b2acb
commit 5ee51198a7
11 changed files with 396 additions and 110 deletions

View 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')

View 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')

View File

@@ -0,0 +1,5 @@
// Actor that allocates memory until killed by memory limit
var big = []
while (1) {
big[] = array(10000, 0)
}