Close retained connectors on worker shutdown

This commit is contained in:
udo
2026-07-20 14:04:39 +00:00
parent 80eaf0b69b
commit e22cbf8882
4 changed files with 22 additions and 2 deletions
+3
View File
@@ -257,6 +257,9 @@ Important settings:
4 KiB positional read. Cache-miss full-artifact reads use the same checks
around 64 KiB positional chunks. A single in-progress regular-file syscall
cannot be cooperatively interrupted; later reads and parsing cannot overrun the budget.
Wasmtime's serialized-module deserialization call is also synchronous and
cannot be interrupted; if it stalls, the timeout is reported after that call
returns rather than at the nominal wall-clock boundary.
Initial/final descriptor identity, unique selected metadata sections, and
strict 64-bit LEB high-bit validation reject changed or ambiguous artifacts.
+4
View File
@@ -266,6 +266,10 @@ Cold module compilation and deserialization are host work, so `load_unit()`
refreshes the epoch deadline before its first guest call. Otherwise a component
whose compilation outlasted the guest CPU budget would immediately trap in the
following allocator/relocation call even though no guest loop consumed it.
Wasmtime's serialized-module deserialization API is synchronous and has no
cooperative cancellation point. The absolute invocation timeout is checked
immediately after it returns, so a stalled deserialization may overrun the
nominal wall boundary before UCE reports the timeout.
Unit artifacts live beneath an ABI-generation directory such as
`BIN_DIRECTORY/units-c13-w7`: `c13` is the compiler/unit-metadata ABI and `w7`
@@ -108,4 +108,15 @@ third=$(request /database.uce)
IFS='|' read -r third_pid third_id third_source <<<"$third"
[[ "$third_pid" == "$first_pid" && "$third_source" == "new" && "$third_id" != "$first_id" ]]
sleep 3
plain=$(request /plain.uce)
[[ "$plain" == "$first_pid|plain" ]]
deadline=$((SECONDS + 5))
while (( SECONDS < deadline )); do
connections=$(mariadb --batch --skip-column-names -e "SELECT COUNT(*) FROM information_schema.PROCESSLIST WHERE USER='$test_user'")
[[ "$connections" == "0" ]] && break
sleep 0.05
done
[[ "$connections" == "0" ]] || { echo "final pooled fixture connection remained after idle eviction" >&2; exit 1; }
echo "Persistent MySQL idle eviction preserved hot reuse and retired the expired connection"
+4 -2
View File
@@ -429,8 +429,8 @@ String wasm_backend_serve(Request& request, const String& entry_unit, const Stri
return("");
}
// Stop the ticker before the worker process exits (best-effort; forked workers
// are usually killed, but a clean ager-out path should join the thread).
// Stop the ticker before destroying the worker state it references. Deleting
// the worker also closes retained connector resources on a clean process exit.
void wasm_backend_shutdown()
{
if(g_wasm_epoch_ticker)
@@ -441,4 +441,6 @@ void wasm_backend_shutdown()
delete g_wasm_epoch_ticker;
g_wasm_epoch_ticker = 0;
}
delete g_wasm_worker;
g_wasm_worker = 0;
}