tracker
All repositories: gitoria
2.2 KB
// reset-peer.mjs — mission 512. A TLS server that finishes the handshake and then// resets the connection must not kill the Hybriel program with SIGPIPE (exit 141,// which took the live tracker down every few minutes). The program has to see an// ordinary fetch error, catch it with `on Error`, and run to its end (exit 0).// Below what an .hl fixture can reach: it needs a raw TLS peer that resets.import { spawn, execFileSync } from 'node:child_process';import tls from 'node:tls';import fs from 'node:fs';import os from 'node:os';import path from 'node:path';import { fileURLToPath } from 'node:url';const HERE = path.dirname(fileURLToPath(import.meta.url));const ROOT = path.resolve(HERE, '../../..');const BIN = process.env.HL_BIN || path.resolve(ROOT, 'native/zig-out/bin/hybriel');const PORT = Number(process.env.HL_TEST_PORT || 14979);const dir = fs.mkdtempSync(path.join(process.env.TMPDIR || os.tmpdir(), 'reset-peer-'));const key = path.join(dir, 'k.pem'), cert = path.join(dir, 'c.pem');execFileSync('openssl', ['req', '-x509', '-newkey', 'rsa:2048', '-nodes', '-keyout', key, '-out', cert,'-days', '2', '-subj', '/CN=localhost', '-addext', 'subjectAltName=DNS:localhost,IP:127.0.0.1'], { stdio: 'ignore' });const server = tls.createServer({ key: fs.readFileSync(key), cert: fs.readFileSync(cert) }, (s) => {s.on('error', () => {});if (s.socket && s.socket.resetAndDestroy) s.socket.resetAndDestroy(); else s.destroy();});await new Promise((r) => server.listen(PORT, '127.0.0.1', r));const child = spawn(BIN, [path.join(HERE, 'reset_peer.hl')], {env: { ...process.env, HL_TEST_PORT: String(PORT), HL_TEST_CA: cert },stdio: ['ignore', 'pipe', 'pipe'],});let log = '';child.stdout.on('data', (d) => { log += d; });child.stderr.on('data', (d) => { log += d; });const timer = setTimeout(() => child.kill('SIGKILL'), 100000);const [code, sig] = await new Promise((r) => child.on('exit', (c, s) => r([c, s])));clearTimeout(timer);server.close();fs.rmSync(dir, { recursive: true, force: true });if (code === 0 && log.includes('survived 150')) { console.log('PASS survived 150 resets'); process.exit(0); }console.log(`FAIL exit code ${code} signal ${sig} (141 = SIGPIPE killed it)\n` + log.slice(-1500));process.exit(1);
Branches
Latest commits
- 2047955bMerge branch 'u12-gateports' into mainTracker
- 4e018678|||PR deploy.sh: gates use Tracker's ports 8716-8719 and LC_ALL=C; README: 2 backups keptTracker
- 0b86324aMerge branch 'records-dp73' into mainTracker
- 9ce5f59b|||PR records: DP73 live 613ae0e; deploy.sh keeps 2 backupsTracker
- 613ae0ecMerge branch 'bs3' into mainTracker
- 1383264b|||PR BS3: keep shared synchronous sorting fastTracker
- 63e5ba1a|||PR BS3: guard boot imports and share resumable sort buffersTracker
- 310613f1Merge branch 'records-dp72' into mainTracker
- 6f7b61ba|||PR records: deploy-swap fix live, Kunibert findingsTracker
- c41587d2Merge branch 'bs2' into mainTracker
- 0dd538a6|||PR BS2: finish the boot index in slices so a booting instance keeps answeringTracker
- 019d5cedMerge branch 'records-1110' into mainTracker
- f88ae8b9|||PR records: day56 toggle live, reviewTracker
- b6b3bb4dMerge branch 'ap56e' into mainTracker
- 29a26da9|||PR AP56e: guard hidden show helpers during session syncTracker
- 7c9ec236|||PR AP56e: re-vendor Hybriel set day56 (source 36ae83a8, bin c1f595a2)Tracker
- 4b54f6f9Merge branch 'records-audit' into mainTracker
- cab4a3bc|||PR records: branch audit, PR-onlyTracker
- 641e1c4cMerge branch 'records-dp71' into mainTracker
- 85a6e9f5|||PR records: DP71 checked in ChromeTracker