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
- e55b379dKeep shared app title independent of the route import graphmre
- 85fa6c9blog: CB68 result, CB69 startedmre
- 2f07c1b7log: DP68 boot gate failed, CB68mre
- 9652782dlog: HM59 merged, DP68 startedmre
- 29867a75Merge hm59-logic: tracker#59 page logic moved to libmre
- f7bfe90bMove remaining page builders into their topicsmre
- 7c3991f9log: day46 from Antonmre
- ec54fc35Move show page logic into the shows topicmre
- c1a8d074log: correct timesmre
- 5827eba9log: HM57 merged, HM59 startedmre
- d1a91be9Merge hm57-let: tracker#57 let only for reassigned namesmre
- a404ed75Report HM57 audit, gates and integration notesmre
- 1dcb87a7Use plain declarations for unchanged bindingsmre
- b90395e3log: HM51 mergedmre
- 9888d076Merge hm51-classes: tracker#51 views use Style referencesmre
- 4399bc2fReference remaining component-owned root Style rulesmre
- 9edcc2dflog: #58 live, HM57 startedmre
- 73fa20ddMerge hm49b-styles: tracker#49 rest of the component stylesmre
- aed12917Reference owned Style rules in genres and searchmre
- 14195720log: HM49B done, HM51 startedmre