gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit8e6aa91d8e6aa91dlog: GC1 deploy retrymre8e6aa91d/plugins/fetch/tests/reset-peer.mjs

2.2 KB

  1. // reset-peer.mjs — mission 512. A TLS server that finishes the handshake and then
  2. // resets the connection must not kill the Hybriel program with SIGPIPE (exit 141,
  3. // which took the live tracker down every few minutes). The program has to see an
  4. // ordinary fetch error, catch it with `on Error`, and run to its end (exit 0).
  5. // Below what an .hl fixture can reach: it needs a raw TLS peer that resets.
  6. import { spawn, execFileSync } from 'node:child_process';
  7. import tls from 'node:tls';
  8. import fs from 'node:fs';
  9. import os from 'node:os';
  10. import path from 'node:path';
  11. import { fileURLToPath } from 'node:url';
  12. const HERE = path.dirname(fileURLToPath(import.meta.url));
  13. const ROOT = path.resolve(HERE, '../../..');
  14. const BIN = process.env.HL_BIN || path.resolve(ROOT, 'native/zig-out/bin/hybriel');
  15. const PORT = Number(process.env.HL_TEST_PORT || 14979);
  16. const dir = fs.mkdtempSync(path.join(process.env.TMPDIR || os.tmpdir(), 'reset-peer-'));
  17. const key = path.join(dir, 'k.pem'), cert = path.join(dir, 'c.pem');
  18. execFileSync('openssl', ['req', '-x509', '-newkey', 'rsa:2048', '-nodes', '-keyout', key, '-out', cert,
  19. '-days', '2', '-subj', '/CN=localhost', '-addext', 'subjectAltName=DNS:localhost,IP:127.0.0.1'], { stdio: 'ignore' });
  20. const server = tls.createServer({ key: fs.readFileSync(key), cert: fs.readFileSync(cert) }, (s) => {
  21. s.on('error', () => {});
  22. if (s.socket && s.socket.resetAndDestroy) s.socket.resetAndDestroy(); else s.destroy();
  23. });
  24. await new Promise((r) => server.listen(PORT, '127.0.0.1', r));
  25. const child = spawn(BIN, [path.join(HERE, 'reset_peer.hl')], {
  26. env: { ...process.env, HL_TEST_PORT: String(PORT), HL_TEST_CA: cert },
  27. stdio: ['ignore', 'pipe', 'pipe'],
  28. });
  29. let log = '';
  30. child.stdout.on('data', (d) => { log += d; });
  31. child.stderr.on('data', (d) => { log += d; });
  32. const timer = setTimeout(() => child.kill('SIGKILL'), 100000);
  33. const [code, sig] = await new Promise((r) => child.on('exit', (c, s) => r([c, s])));
  34. clearTimeout(timer);
  35. server.close();
  36. fs.rmSync(dir, { recursive: true, force: true });
  37. if (code === 0 && log.includes('survived 150')) { console.log('PASS survived 150 resets'); process.exit(0); }
  38. console.log(`FAIL exit code ${code} signal ${sig} (141 = SIGPIPE killed it)\n` + log.slice(-1500));
  39. process.exit(1);

Branches

Latest commits

  • 8e6aa91dlog: GC1 deploy retrymre
  • 87ad2dc1log: GC1 deployingmre
  • 53f10fb8Merge branch 'gc1-deploy'mre
  • 7fcbf1d2log: GC1 deploy GOmre
  • 1fb6664bcompose: TRACKER_QSTATS=1 (GC1 measurement)mre
  • 6576c1cdgc1: release the people-view scan lists once the view is builtmre
  • 94f8a373gc1: back out the kept episode-id set (no measurable gain on /my/unwatched: 4.69 -> 4.61 GB per 150 loads)mre
  • a1a88bd4gc1: search skips the stale-key string while no entry is stale; /my/unwatched asks a kept id set instead of building a key string per episode rowmre
  • cd830744gc1: dbSearch: no split / map / list copy per candidate (scores from the stored text, top list touched only when the hit can enter)mre
  • 451db7cdgc1: show page and check clicks read the kept watched set instead of building one from a by-value copy of every watchmre
  • ddb4127egc1: TRACKER_QSTATS=1 logs queue and cache sizes every 10 s (measurement only)mre
  • da60547fstatus: GC1 done, backup bugmre
  • e4171021log: GC1 result, backup hard-link bugmre
  • f1597214deploy.sh backup: tar --hard-dereference (hot tar stored mpackdb sidecars as hard links to .sessions files)mre
  • 6b58571elog: GC windowmre
  • 5c8baa1fdeploy lock: hold only around deploy.shmre
  • b8dac822log: hybriel#309mre
  • bf676d9elog: GC1 startedmre
  • c7828541mission GC1mre
  • ef949994conductor: neutral ticket rulemre