probe attach doesn't compile in `async` contexts

Abierto
#723 1 comentario 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
42/100
Tipo de issue
Refactorización
Claridad
Necesita aclaración
Estado de actividad
Tranquilo
Stack tecnológico
rust
Área
devtools

Línea de trabajo

Comienza en verifier/src/hiffy.rs:108 e inspecciona HubrisArchive en humility-core/src/hubris.rs:1133, donde el compilador informa del problema de Send/Sync de OnceCell. Reproduce el fallo de compilación async y rastrea los tipos de addr2line y gimli implicados. Se considera completado cuando probe attach compila en contextos async sin este error.

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

Descripción

While working on using humility as a library I ran into this:

error[E0277]: `OnceCell<Result<Option<Box<DwoUnit<EndianReader<LittleEndian, Arc<[u8]>>>>>, Error>>` cannot be shared between threads safely
    --> verifier/src/hiffy.rs:108:5
     |
 108 |     async fn get_measurement_log(&self) -> Result<Log, AttestError> {
     |     ^^^^^ `OnceCell<Result<Option<Box<DwoUnit<EndianReader<LittleEndian, Arc<[u8]>>>>>, Error>>` cannot be shared between threads safely
     |
     = help: within `[addr2line::unit::ResUnit<gimli::read::endian_reader::EndianReader<gimli::endianity::LittleEndian, Arc<[u8]>>>]`, the trait `Sync` is not implemented for `OnceCell<Result<Option<Box<DwoUnit<EndianReader<LittleEndian, Arc<[u8]>>>>>, Error>>`
     = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::OnceLock` instead

...

note: required because it appears within the type `HubrisArchive`
    --> /home/labbott/.cargo/git/checkouts/humility-a1f94f6d75a1535e/80dae8d/humility-core/src/hubris.rs:1133:12
     |
1133 | pub struct HubrisArchive {
     |            ^^^^^^^^^^^^^
note: required because it appears within the type `AttestHiffy`
    --> verifier/src/hiffy.rs:66:12
     |
  66 | pub struct AttestHiffy {
     |            ^^^^^^^^^^^
     = note: required for `&AttestHiffy` to implement `Send`
note: required because it's used within this `async` block
    --> verifier/src/hiffy.rs:108:5
     |
 108 |     async fn get_measurement_log(&self) -> Result<Log, AttestError> {
     |     ^^^^^
     = note: required for the cast from `Pin<Box<{async block@verifier/src/hiffy.rs:108:5: 108:10}>>` to `Pin<Box<dyn Future<Output = Result<MeasurementLog<16>, AttestError>> + Send>>`
     = note: the full name for the type has been written to '/home/labbott/dice-util/target/debug/deps/dice_verifier-b365f235203b0dbe.long-type-6895664460909633821.txt'
     = note: consider using `--verbose` to print the full type name to the console

$ cat /home/labbott/dice-util/target/debug/deps/dice_verifier-b365f235203b0dbe.long-type-3655248516427123308.txt
std::ptr::Unique<[addr2line::unit::ResUnit<gimli::read::endian_reader::EndianReader<gimli::endianity::LittleEndian, Arc<[u8]>>>]>
hashbrown::raw::RawTable<(HubrisTask, addr2line::Context<gimli::read::endian_reader::EndianReader<gimli::endianity::LittleEndian, Arc<[u8]>>>)>
hashbrown::map::HashMap<HubrisTask, addr2line::Context<gimli::read::endian_reader::EndianReader<gimli::endianity::LittleEndian, Arc<[u8]>>>, RandomState>
HashMap<HubrisTask, addr2line::Context<gimli::read::endian_reader::EndianReader<gimli::endianity::LittleEndian, Arc<[u8]>>>>

This looks like the addr2line and gimli crates don't play nice with async at the moment and humility needs a little bit of refactoring.

Lenguaje dominante
Rust
Estrellas
590
Forks
67
Merge medio
1 d 2 h
PR fusionados (30 d)
9

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 oxidecomputer/humility

Todos los issues de oxidecomputer/humility

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.