Commit 6d637b8
authored
fix(bench): dispose WASM worker pool and keep progress off stdout (#1009)
* fix(bench): dispose WASM worker pool and keep progress off stdout
v3.9.5 moved WASM tree-sitter parsing into a node:worker_threads Worker
(via a shared singleton pool in src/domain/wasm-worker-pool.ts). The
benchmark worker scripts never dispose that pool, so the worker thread
kept the event loop alive after JSON was written to stdout. The parent
fork-engine then SIGKILLed the hung child at 600s and discarded the
valid stdout as "Both engines failed."
Also fix the embedding benchmark: src/domain/search/models.ts wrote
"Embedded N/M\r" progress directly to process.stdout, bypassing the
worker's console.log->stderr redirect and corrupting the JSON payload
with "Unexpected token 'E'..." errors.
- benchmark/query/incremental/resolution scripts: import disposeParsers
from the installed package (try/catch for older releases) and call it
before cleanup(), then process.exit(0) to guarantee termination.
- fork-engine: on SIGKILL, try to salvage captured stdout as JSON before
giving up — defence-in-depth against future event-loop-keepalive bugs.
- search/models.ts: write progress to stderr so it can't pollute stdout
in JSON-consuming benchmark workers.
docs check acknowledged — internal benchmark infra fix, no user-facing
docs affected.
Impact: 7 functions changed, 16 affected
* fix(bench): move process.exit(0) outside finally to preserve exception exit codes (#1009)
Addresses Greptile P1: placing process.exit(0) inside the finally block
would swallow exceptions from the try body (missing fixture, DB open failure,
import error) and exit with code 0, masking the failure from CI and the
parent forkWorker. Mirror the pattern in benchmark.ts/incremental-benchmark.ts/
query-benchmark.ts: exit only after the success path completes.1 parent 176e3f0 commit 6d637b8
6 files changed
Lines changed: 50 additions & 2 deletions
File tree
- scripts
- lib
- src/domain/search
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
85 | 92 | | |
86 | 93 | | |
87 | 94 | | |
| |||
226 | 233 | | |
227 | 234 | | |
228 | 235 | | |
| 236 | + | |
229 | 237 | | |
| 238 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
146 | 153 | | |
147 | 154 | | |
148 | 155 | | |
| |||
218 | 225 | | |
219 | 226 | | |
220 | 227 | | |
| 228 | + | |
221 | 229 | | |
| 230 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
97 | 108 | | |
98 | 109 | | |
99 | 110 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
97 | 104 | | |
98 | 105 | | |
99 | 106 | | |
| |||
259 | 266 | | |
260 | 267 | | |
261 | 268 | | |
| 269 | + | |
262 | 270 | | |
| 271 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
222 | 230 | | |
223 | 231 | | |
224 | 232 | | |
| |||
296 | 304 | | |
297 | 305 | | |
298 | 306 | | |
| 307 | + | |
299 | 308 | | |
300 | 309 | | |
| 310 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
256 | | - | |
| 256 | + | |
257 | 257 | | |
258 | 258 | | |
259 | 259 | | |
| |||
0 commit comments