test buffer: failed Next advances the read position

Aperta
#2,017 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

@Drifter-yh ci sta già lavorando.

Dal 30/10/2026.

  • #2018 di @Drifter-yh — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
30/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
go
Ambito
backend

Direzione di ricerca

Start by locating the default test ByteBuffer implementation and its Next method; the issue identifies pkg/remote as the package to test. Run go test ./pkg/remote -count=1 and verify that a failed Next leaves ReadLen and ReadableLen unchanged; note that linked pull request #2018 is already open.

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

Descrizione

Description

The default remote.ByteBuffer used for tests advances readIdx even when Next(n) fails because fewer than n bytes remain. The failed read changes ReadLen and ReadableLen and prevents a subsequent valid read. This concerns the default test helper; it is not a claim about production transports.

Reproduction

b := remote.NewReaderBuffer([]byte("abc"))
defer b.Release(nil)
b.Next(1)              // reads "a"
_, err := b.Next(3)    // error: only two bytes remain
fmt.Println(err != nil, b.ReadLen(), b.ReadableLen()) // true 4 -1; expected true 1 2

Current main at 30428b5bfae42d334dbc3653e5b59edcf619fc9a, Go 1.26.3 on Windows. A focused regression test fails before changing Next to advance only when Peek succeeds, and go test ./pkg/remote -count=1 passes with that change.

I searched existing issues and pull requests for defaultByteBuffer, Next, readIdx, and read-position failures; I found no corresponding report. I can submit the small fix and regression test if useful.

AI assistance was used to investigate, implement and test this report.

Lingua principale
Go
Stelle
8.1k
Fork
921
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

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 cloudwego/kitex

Tutte le issue di cloudwego/kitex

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.