Add a fault-injection test for the signal transport drain

Aperta
#517 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
c, macos

Direzione di ricerca

Start with drain_signal_transport and transport_read_chunk in src/syscall/proc.c, then trace preempt_thread_main and drain_after_wait to understand retries and warning behavior. Add a host unit test using a scratch transport file and fault hooks for the listed host calls. Verify retry state, record handling, warning frequency, failed truncation, and the first-flock size bound under concurrent appends.

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

Descrizione

Problem

drain_signal_transport in src/syscall/proc.c has failure paths that no test reaches: open failing with an error other than ENOENT, the flock, fstat or pread in transport_read_chunk failing, and a failed ftruncate. On a failure the drain keeps the records, sets transport_retry, and the SIGALRM tick in preempt_thread_main retries it. Since #505, sys_wait4 and sys_waitid also retry a failed drain once inline (drain_after_wait) before they return, and the warning is logged once per run of failures (transport_read_failing). The size bound added in #505 (a drain stops at the file size it saw under its first flock) is also only checked by reading: no test keeps a sender appending while a drain runs.

A guest test cannot make these host calls fail, so a regression on any of these paths would pass make check and make test-matrix.

Proposal

Add a host unit test that drives the drain against a scratch transport file with the host calls it makes wrapped behind a small fault hook (fail the next N calls of open, flock, fstat, pread or ftruncate with a chosen errno). It would check that:

  • no record is lost or handled twice across a failed and a retried drain;
  • transport_retry is set after each kind of failure and cleared by a drain that succeeds;
  • the warning is logged once per run of failures;
  • a failed truncate leaves the offset at the end, so the next drain does not handle the same records again;
  • a drain ends at the size it saw under its first flock while another thread keeps appending, and the next drain picks up the rest.

Alternatives

A guest test under a second elfuse build that injects the failures. That build would not run in CI.

Origin

Follow-up from #505 (https://github.com/sysprog21/elfuse/pull/505#discussion_r4542048059). Related: #507.

Lingua principale
C
Stelle
287
Fork
33
Merge medio
2g 17h
PR unite (30g)
18

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 sysprog21/elfuse

Tutte le issue di sysprog21/elfuse

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.