libsql / sqld

LibSQL with extended capabilities like HTTP protocol, replication, and more.
https://libsql.org
903 stars 38 forks source link

hrana: add diagnostics for connections #729

Closed psarna closed 1 year ago

psarna commented 1 year ago

This commit adds a /v1/diagnostics admin endpoint which prints various information about current hrana-over-http connections.

Draft, because the diagnostics are currently in a very debuggy format, and I'm figuring out if we can make it more human-readable. Still, they're enough to determine if something is holding a lock via an abandoned hrana-over-http stream.

Example:

$ curl -s http://localhost:8082/v1/diagnostics | jq
[
  "expired",
  "(conn: Mutex { data: <locked> }, timeout_ms: 0, stolen: true)",
  "expired",
  "(conn: Mutex { data: <locked> }, timeout_ms: 4291, stolen: false)",
  "expired",
  "expired",
  "<no-transaction>",
  "acquired"
]
MarinPostma commented 1 year ago

@psarna, can you rebase maybe?

psarna commented 1 year ago

This PR should have absolutely 0 to do with with bottomless, and yet I see bottomless test failures, that always pass for me locally. Maybe we have some kind of regression, let me investigate

psarna commented 1 year ago

Oh wait, now they failed for me locally too, good