`cloudflare` feature: hrana streams are never closed

Aperta Adatta ai principianti
#2,312 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 11 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
databases

Direzione di ricerca

Leggi libsql/src/hrana/stream.rs e confronta la condizione di compilazione dell’implementazione di Drop di RawStream con la configurazione della feature cloudflare. Conferma il comportamento con default-features = false, features = ["cloudflare"] verificando se l’eliminazione di uno stream invia una richiesta di chiusura. Il lavoro è completato quando gli stream aperti con questa configurazione vengono chiusi alla loro eliminazione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

With default-features = false, features = ["cloudflare"], the client never sends a close request for the hrana streams it opens. The Drop impl that sends it is compiled only with the remote feature.

Where

libsql/src/hrana/stream.rs. The code is identical in 0.9.30, 0.10.0 and current main:

#[cfg(feature = "remote")]
impl<T> Drop for RawStream<T>
where
    T: HttpSend,
{
    fn drop(&mut self) {
        let baton = self.baton.get_mut().take();
        if let Some(baton) = baton {
            // ... sends StreamRequest::Close via self.client.oneshot(...)
        }
    }
}

With only cloudflare enabled, this impl does not exist, so dropping a RawStream sends nothing.

What we observed

Setup:

  • libsql 0.9.30 (default-features = false, features = ["cloudflare"])
  • worker 0.6.7, wrangler dev 4.105.0
  • local sqld 0.24.31 with default settings

We sent a few dozen sequential requests to the worker; each request runs several statements. Every query after that failed. sqld logged:

ERROR libsql_server::hrana::http: hrana server: Timed out while opening database connection
ERROR libsql_server::error: HTTP API: 429 Too Many Requests, DbCreateTimeout

The client got:

Hrana: `api error: `{"error":"Timed out while opening database connection"}``

After restarting sqld with --max-concurrent-connections 4096 --max-concurrent-requests 4096, the same requests (over 200 sequential ones) succeeded.

Lingua principale
C
Stelle
17.3k
Fork
557
Merge medio
10g 15h
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di tursodatabase/libsql

Tutte le issue di tursodatabase/libsql

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.