Skip to main content

Timeout

Simple Story

A pupil who never stops never finishes and never fails. They simply sit there.

So the clock hangs outside the room, and when the time is up it stops them. Outside matters: a pupil stuck in a loop cannot be trusted to time themselves. Ares reads this clock from the checklist and does not yet wind it up, so @StrictTimeout is what bounds a test today.

What it is

timeout runs a command with a time limit and sends it a signal when the limit is exceeded. It is part of GNU coreutils and needs no special privileges.

How Phobos uses it

phobos-timeout.sh is the outermost of the three layers, applying the budget from regardingTimeouts in the policy. It can be disabled with --no-timeout, as each layer can be disabled independently.

The JVM-side @StrictTimeout bounds an individual test from inside the Java Virtual Machine (JVM). This layer bounds the whole supervised command from outside it, and therefore still applies when the JVM itself is wedged.

It is the simplest illustration of the wrapper idea: enforcement in a process that outlives the thing it supervises.

Further reading