• Marcin S.'s avatar
    Replace async-std with tokio in PVF subsystem (#6419) · 44fd9566
    Marcin S. authored
    
    
    * Replace async-std with tokio in PVF subsystem
    
    * Rework workers to use `select!` instead of a mutex
    
    The improvement in code readability is more important than the thread overhead.
    
    * Remove unnecessary `fuse`
    
    * Add explanation for `expect()`
    
    * Update node/core/pvf/src/worker_common.rs
    
    Co-authored-by: default avatarBastian Köcher <[email protected]>
    
    * Update node/core/pvf/src/worker_common.rs
    
    Co-authored-by: default avatarBastian Köcher <[email protected]>
    
    * Address some review comments
    
    * Shutdown tokio runtime
    
    * Run cargo fmt
    
    * Add a small note about retries
    
    * Fix up merge
    
    * Rework `cpu_time_monitor_loop` to return when other thread finishes
    
    * Add error string to PrepareError::IoErr variant
    
    * Log when artifacts fail to prepare
    
    * Fix `cpu_time_monitor_loop`; fix test
    
    * Fix text
    
    * Fix a couple of potential minor data races.
    
    First data race was due to logging in the CPU monitor thread even if the
    job (other thread) finished. It can technically finish before or after the log.
    
    Maybe best would be to move this log to the `select!`s, where we are guaranteed
    to have chosen the timed-out branch, although there would be a bit of
    duplication.
    
    Also, it was possible for this thread to complete before we executed
    `finished_tx.send` in the other thread, which would trigger an error as the
    receiver has already been dropped. And right now, such a spurious error from
    `send` would be returned even if the job otherwise succeeded.
    
    * Update Cargo.lock
    
    Co-authored-by: default avatarBastian Köcher <[email protected]>
    44fd9566