diff --git a/infra/fast-time/tn-late-join.mjs b/infra/fast-time/tn-late-join.mjs index 87db8444..e3cb8aa9 100644 --- a/infra/fast-time/tn-late-join.mjs +++ b/infra/fast-time/tn-late-join.mjs @@ -101,6 +101,7 @@ class Node { const out = openSync(this.logFile, 'a'); this.proc = spawn(IGNEUMD, a, { stdio: ['ignore', out, out], env: { ...process.env, IGNEUM_CLASS_SIGNAL: '4' } }); started.push(this.proc); + writeFileSync(`${TMP}/n${this.i}.pid`, String(this.proc.pid)); await sleep(1500); if (this.proc.exitCode != null) throw new Error(`n${this.i} exited ${this.proc.exitCode}: ${this.grepLog(/ERROR|Error|error|refused|invalid/).slice(-3).join(' | ')}`); for (let i = 0; i < 20; i++) { @@ -118,6 +119,7 @@ function miner(name, grpc, threads, secs) { const out = openSync(`${TMP}/${name}.log`, 'a'); const p = spawn(CPU_MINER, ['mine', grpc, String(threads), String(secs), name, '--engine', 'igneum-pow', '--payout-label', name, '--status-secs', '60', '--no-vote', '--stall-secs', '0'], { stdio: ['ignore', out, out], env: { ...process.env, IGNEUM_POW_DAY_MS: String(DAY_MS) } }); started.push(p); + writeFileSync(`${TMP}/${name}.pid`, String(p.pid)); return p; } async function stopAll() { @@ -127,6 +129,7 @@ async function stopAll() { } process.on('SIGINT', async () => { await stopAll(); process.exit(130); }); process.on('unhandledRejection', async (e) => { log(`FAILED: ${e?.stack || e}`); await stopAll(); process.exit(3); }); +process.on('uncaughtException', async (e) => { log(`FAILED: ${e?.stack || e}`); await stopAll(); process.exit(3); }); const a = await new Node(0).start(); const genesis = (await a.dag()).pruningPointHash; @@ -136,6 +139,8 @@ let prover = null; if (PROVER) { const out = openSync(`${TMP}/prover.log`, 'a'); prover = spawn('/bin/sh', ['-c', PROVER], { stdio: ['ignore', out, out], env: { ...process.env, IGNEUM_GRPC: a.grpc, IGNEUM_EVM_RPC: `http://127.0.0.1:${a.evmPort}` } }); + started.push(prover); + writeFileSync(`${TMP}/prover.pid`, String(prover.pid)); log(`prover up pid ${prover.pid}: ${PROVER}`); } const t0 = Date.now();