I was testing mesos cgroups isolation. To see what kind of error gets thrown. I ran the below shell program with marathon. Assigned 1 MB memory and 1 CPU.
#!/bin/sh
temp=a
while :
do
temp=$temp$temp
echo ${#temp}
sleep 1
done
A single character takes 1B of space so the program above needs to throw an exception once the length of the temp string reaches about 1 MB. But the tasks seem to get killed randomly. The task sometimes gets killed at length 1048576 or 2097152 or 4194304. Ideally since 1MB is the limit it should have stopped when length is 524288.
Additional info - Slave is run with --isolation='cgroups/cpu,cgroups/mem' Mesos version - 0.25