Menu

Reference / Async

watchdog()

function
function watchdog(float $milliseconds): void

Name any task that holds the loop longer than $milliseconds.

When a task runs that long without suspending, a line naming it is written to STDERR. 0 turns it off. MANTICORE_ASYNC_WATCHDOG=<ms> does the same without touching the program. A cooperative loop cannot preempt, so the report necessarily comes after the stall; it catches the otherwise invisible causes: a CPU-bound stretch with no suspend point, a blocking call, a library falling back to blocking I/O. Each task reports its first breach and then only a doubling, so a CPU-heavy worker does not flood the log.

async: watchdog - task #4 "report" at app.php:88 held the loop 214.3 ms (limit 50 ms)

Parameters

$milliseconds float
the threshold; 0 or less turns the watchdog off

See also: dump, stats

View source