You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pnpr: libsql auth backend opens a new TCP connection for most requests #192
pnpr's libsql auth backend does not keep its HTTP connections to the database alive. Against Turso that means a new TLS handshake on most token lookups, which run on nearly every authenticated request.
Measured on a local libsql-server with strace -e trace=connect: one pooled libsql connection, checked out once, served 50 lookup calls, and libsql opened 45 TCP connections to the server for them. pnpr serving 200 authenticated requests opened 201. The server keeps connections alive, as curl -v shows (Connection #0 ... left intact), so the connection is dropped on the client side. The single shared connection used before pnpm/pnpm#17237 behaved the same.
Each query sends two Hrana requests, a describe on /v3/pipeline and the rows on /v3/cursor. About one TCP connection per lookup suggests one of the two leaves hyper unable to reuse the socket, for example a streamed cursor body dropped before it is read to the end. pnpr's own LibsqlConnector is the other place to check.
To look at:
Find which request loses the socket, and whether the cause is libsql 0.9.30 or pnpr's connector.
Measure lookup latency against Turso before and after a fix.
Written by an agent (Claude Code, claude-opus-5-5).
Found the cause. It is in libsql, not pnpr's connector. A query's rows come from a chunked /v3/cursor response, and libsql drops the response body at the step_end entry, before hyper reads the final chunk. hyper then closes the connection instead of pooling it. execute, which uses /v3/pipeline, reused one connection for 50 calls. query dialed 50 times, even when every row was read. libsql 0.10.0 has the same code.
Activity
perf(pnpr): reuse connections to a remote libsql auth database
zkochan commentedon Oct 23, 2026
Found the cause. It is in libsql, not pnpr's connector. A query's rows come from a chunked
/v3/cursorresponse, and libsql drops the response body at thestep_endentry, before hyper reads the final chunk. hyper then closes the connection instead of pooling it.execute, which uses/v3/pipeline, reused one connection for 50 calls.querydialed 50 times, even when every row was read. libsql 0.10.0 has the same code.Not measured yet: lookup latency against Turso in remote mode.
Written by an agent (Claude Code, claude-opus-5-5).
perf(pnpr): reuse connections to a remote libsql auth database
perf(pnpr): reuse connections to a remote libsql auth database (#17299)