Found by adversarial audit @ 261d00b, confirmed with corrected magnitude (original 14x/~400MB claim refuted down).
Mechanism: upsert.ts:120 retains the raw c.req.json() graph through the awaited write phase; Zod parse builds a second copy; vectors.map eagerly allocates per-vector Float32Array+Buffer+base64+JSON metadata all held by writes until the unchunked Promise.all (upsert.ts:170-191). Net ≈2-3× body peak per request (parsed doubles 8B/value + Float32 4B + base64 5.33B vs JSON text). bodyLimit bounds size, not concurrency: N parallel max-batches scale linearly.
Fix direction: drop the body reference before heavy work, dispatch EVALs in bounded chunks (e.g. 128) so encoded payloads become garbage promptly, optionally a global concurrent-write semaphore.
Found by adversarial audit @ 261d00b, confirmed with corrected magnitude (original 14x/~400MB claim refuted down).
Mechanism: upsert.ts:120 retains the raw c.req.json() graph through the awaited write phase; Zod parse builds a second copy; vectors.map eagerly allocates per-vector Float32Array+Buffer+base64+JSON metadata all held by
writesuntil the unchunked Promise.all (upsert.ts:170-191). Net ≈2-3× body peak per request (parsed doubles 8B/value + Float32 4B + base64 5.33B vs JSON text). bodyLimit bounds size, not concurrency: N parallel max-batches scale linearly.Fix direction: drop the body reference before heavy work, dispatch EVALs in bounded chunks (e.g. 128) so encoded payloads become garbage promptly, optionally a global concurrent-write semaphore.