segfault in async state drop glue: `Arc` field dropped while zeroed

Abierto
#270 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
25/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
rust
Área
compilers

Línea de trabajo

Start from the async-state lowering code that generates drop glue for a future's state, particularly how drop flags and field offsets are assigned for fields holding guards across an .await. The fault is in Arc::drop at arc.rs:287 with a null pointer, so confirm why an Arc field is considered initialized when the future is dropped before it was written. There is no standalone reproduction yet: ask the reporter for relax inspect or flight-recorder output and try to reduce the tokio timeout + guard-across-await shape. Done means a reduced reproducer and drop glue that skips uninitialized fields.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

On Relax 953d174a (macOS arm64), dropping an async future segfaults. The same test passes under rustc 1.100.

Observed

A private application's async integration test (tokio multi-thread; a tokio::time::timeout around an async method) segfaults deterministically about 4.8 s in; rustc runs the same test in 0.06 s.

Sanitized top frames:

glue0<Arc<T>>          std/core/sync/arc.rs:287:28   (O2 warm-cache, v1 of 1)
  glue0<closure#...>                                 (drop glue of the async fn's state)
  {closure}@<app>                                    (polls the tokio::time::timeout future)

The fault address is 0xfffffffffffffff0 (a second run: 0xfffffffffffffff2). Arc::drop at arc.rs:287 computes header_of(self.ptr); a null self.ptr yields exactly -size_of::<ArcInner>(), so the Arc field being dropped was zeroed rather than dangling.

Shape

The async fn holds a temporary guard across an .await; the guard owns an Arc:

let v = self.acquire()?.wait().await;

acquire() returns Result<Guard> (the guard owns an Arc clone), and the future is driven by tokio::time::timeout and dropped when it fires.

Reproducing

I have not reduced it to a standalone program yet. Simple async + Arc + timeout shapes do not reproduce:

  • guard temporary across .await, cancelled while pending;
  • the same, completing within the timeout;
  • Arc local across .await, cancelled and completed;
  • yield_now and short sleep variants.

The application is private, so I cannot attach it. I can run diagnostics (relax inspect, flight recorder) or try candidate fixes on request.

Suspect

Looks like async state lowering's drop flag / field offset: the drop glue runs on an Arc field that was never initialized (null, not dangling).

Lenguaje dominante
Rust
Estrellas
601
Forks
34
Merge medio
1 h 58 min
PR fusionados (30 d)
45

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de makepad/relax

Todos los issues de makepad/relax

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.