Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recover client from server restarts when handling batons? #1856

Open
penberg opened this issue Nov 29, 2024 · 2 comments
Open

Recover client from server restarts when handling batons? #1856

penberg opened this issue Nov 29, 2024 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested remote protocol

Comments

@penberg
Copy link
Collaborator

penberg commented Nov 29, 2024

Currently, I think that when a client holds a server-issued baton and attempts to send it back after a server restart, the request fails with a BatonInvalid error. This error breaks the client's workflow and requires manual intervention.

If this turns out to be the case, let's fix that so thatif a BatonInvalid error occurs and no transaction is in progress, the client should:

  • Automatically restart the stream
  • Obtain a new baton from the server
  • Continue normal operation
@penberg penberg added enhancement New feature or request help wanted Extra attention is needed question Further information is requested remote protocol labels Nov 29, 2024
@penberg
Copy link
Collaborator Author

penberg commented Nov 29, 2024

I was testing the Rust SDK and this only happens if restart happens in the middle of an interactive transaction. We send the following error:

thread 'main' panicked at libsql/examples/example.rs:31:23:
called `Result::unwrap()` on an `Err` value: Hrana(Api("Received an invalid baton"))
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Which we should improve to tell that the transaction was aborted.

@penberg
Copy link
Collaborator Author

penberg commented Nov 29, 2024

I suspected that this would trigger with cursors, but in testing it looks like we recover from restarts fine. Or perhaps I was not trying hard enough to figure out a case where this can happen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested remote protocol
Projects
None yet
Development

No branches or pull requests

1 participant