Skip to content

Non-auto-commit connections hold an idle Hrana stream that sqld expires #99

Closed

Description

@magnusp

setAutoCommit(false) begins a transaction immediately. commit() and rollback() begin the next one. An idle non-auto-commit connection therefore always holds a server stream.

IMPLEMENTATION_BUGS_AND_RESOLUTIONS.md records the sqld limits. Idle streams expire after 10 seconds. The server allows 128 concurrent streams.

Expected failure path:

  1. Call setAutoCommit(false), then commit().
  2. Wait more than 10 seconds so sqld expires the stream.
  3. Run a statement. The driver sends the stale baton, and sendPipeline throws.
  4. The driver does not clear the baton. rollback(), commit(), and setAutoCommit(true) send the same dead baton and fail.

Only close() recovers the connection. Before #64 the driver began the next transaction lazily, so idle time cost nothing. A pool that holds more than 128 idle non-auto-commit connections can also fill the stream pool and bring back the stall described in the same document.

No test covers this. The unit tests use a fake client, and TransactionLifecycleIT has no idle step.

Expected:

  • Begin the next transaction lazily, with a "begin pending" flag, so the observable semantics stay the same as sqlite-jdbc.
  • Or detect an expired stream or invalid baton, drop the baton, and report a clear connection-level error.
  • Add an integration test with an idle period longer than the server timeout.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High priority: significant correctness or compatibility gapbugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions