Add a fault-injection test for the signal transport drain

Ouverte
#517 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 2 jours

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
48/100
Type d'issue
Fonctionnalité
Clarté
Plutôt claire
Activité
Active
Stack technique
c, macos

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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.

Langage dominant
C
Étoiles
287
Forks
33
Merge moyen
2 j 17 h
PR mergées (30 j)
18

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de sysprog21/elfuse

Toutes les issues de sysprog21/elfuse

Issues similaires

Plus d'issues C

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.