tn-late-join harness: an uncaughtException hook stops the network, pid files for every process, the prover in the stop list (the pod's attempt 1 left a node and a miner behind after an RPC timeout)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
161cc06d6a
commit
7ef62dd712
1 changed files with 5 additions and 0 deletions
|
|
@ -101,6 +101,7 @@ class Node {
|
||||||
const out = openSync(this.logFile, 'a');
|
const out = openSync(this.logFile, 'a');
|
||||||
this.proc = spawn(IGNEUMD, a, { stdio: ['ignore', out, out], env: { ...process.env, IGNEUM_CLASS_SIGNAL: '4' } });
|
this.proc = spawn(IGNEUMD, a, { stdio: ['ignore', out, out], env: { ...process.env, IGNEUM_CLASS_SIGNAL: '4' } });
|
||||||
started.push(this.proc);
|
started.push(this.proc);
|
||||||
|
writeFileSync(`${TMP}/n${this.i}.pid`, String(this.proc.pid));
|
||||||
await sleep(1500);
|
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(' | ')}`);
|
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++) {
|
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 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) } });
|
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);
|
started.push(p);
|
||||||
|
writeFileSync(`${TMP}/${name}.pid`, String(p.pid));
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
async function stopAll() {
|
async function stopAll() {
|
||||||
|
|
@ -127,6 +129,7 @@ async function stopAll() {
|
||||||
}
|
}
|
||||||
process.on('SIGINT', async () => { await stopAll(); process.exit(130); });
|
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('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 a = await new Node(0).start();
|
||||||
const genesis = (await a.dag()).pruningPointHash;
|
const genesis = (await a.dag()).pruningPointHash;
|
||||||
|
|
@ -136,6 +139,8 @@ let prover = null;
|
||||||
if (PROVER) {
|
if (PROVER) {
|
||||||
const out = openSync(`${TMP}/prover.log`, 'a');
|
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}` } });
|
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}`);
|
log(`prover up pid ${prover.pid}: ${PROVER}`);
|
||||||
}
|
}
|
||||||
const t0 = Date.now();
|
const t0 = Date.now();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue