test(appimage): wait for straggler exec before AppRun exits

- Fixes a flaky keepalive test where, under load, the supervisor could scan /proc while the forked child was still /bin/sh and release the mount too early
- AppRun now polls /proc/$!/exe until it resolves to the straggler binary
This commit is contained in:
sudacode committed 2026-10-28 18:27:40 -07:00
1 parent e59b78dca0
commit ad1abc3268
1 file changed
+9 -4
+9 -4
View File
@@ -114,14 +114,19 @@ linuxTest('keepalive script releases the mount only after straggler processes ex
fs.mkdirSync(mountDir); fs.mkdirSync(mountDir);
// AppRun leaves behind a straggler that keeps executing *from the mount* // AppRun leaves behind a straggler that keeps executing *from the mount*
// after AppRun itself exits — mimicking Chromium utility children. // after AppRun itself exits — mimicking Chromium utility children. AppRun waits
fs.copyFileSync('/usr/bin/sleep', path.join(mountDir, 'straggler')); // until the straggler has exec'd, otherwise under load the supervisor can scan
fs.chmodSync(path.join(mountDir, 'straggler'), 0o755); // /proc while the forked child is still /bin/sh and release the mount early.
const stragglerPath = path.join(mountDir, 'straggler');
fs.copyFileSync('/usr/bin/sleep', stragglerPath);
fs.chmodSync(stragglerPath, 0o755);
writeExecutable( writeExecutable(
path.join(mountDir, 'AppRun'), path.join(mountDir, 'AppRun'),
[ [
'#!/bin/sh', '#!/bin/sh',
`"${mountDir}/straggler" 1 &`, `"${stragglerPath}" 1 &`,
'straggler=$!',
`until [ "$(readlink "/proc/$straggler/exe")" = "${stragglerPath}" ]; do sleep 0.01; done`,
`date +%s%N > "${resultsDir}/apprun-exited"`, `date +%s%N > "${resultsDir}/apprun-exited"`,
'exit 42', 'exit 42',
].join('\n'), ].join('\n'),