Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

PVF: Vote invalid on panics in execution thread (after a retry) #7155

Merged
merged 29 commits into from
May 16, 2023

Commits on May 1, 2023

  1. PVF: Remove rayon and some uses of tokio

    1. We were using `rayon` to spawn a superfluous thread to do execution, so it was removed.
    
    2. We were using `rayon` to set a threadpool-specific thread stack size, and AFAIK we couldn't do that with `tokio` (it's possible [per-runtime](https://docs.rs/tokio/latest/tokio/runtime/struct.Builder.html#method.thread_stack_size) but not per-thread). Since we want to remove `tokio` from the workers [anyway](https://github.com/paritytech/polkadot/issues/7117), I changed it to spawn threads with the `std::thread` API instead of `tokio`.[^1]
    
    [^1]: NOTE: This PR does not totally remove the `tokio` dependency just yet.
    
    3. Since `std::thread` API is not async, we could no longer `select!` on the threads as futures, so the `select!` was changed to a naive loop.
    
    4. The order of thread selection was flipped to make (3) sound (see note in code).
    
    I left some TODO's related to panics which I'm going to address soon as part of #7045.
    mrcnski committed May 1, 2023
    Configuration menu
    Copy the full SHA
    866a690 View commit details
    Browse the repository at this point in the history
  2. PVF: Vote invalid on panics in execution thread (after a retry)

    Also make sure we kill the worker process on panic errors and internal errors to
    potentially clear any error states independent of the candidate.
    mrcnski committed May 1, 2023
    Configuration menu
    Copy the full SHA
    aff4779 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    fc481bc View commit details
    Browse the repository at this point in the history
  4. Address a couple of TODOs

    Addresses a couple of follow-up TODOs from
    #7153.
    mrcnski committed May 1, 2023
    Configuration menu
    Copy the full SHA
    b03e1b0 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    0fcedbe View commit details
    Browse the repository at this point in the history
  6. Fix compile error

    mrcnski committed May 1, 2023
    Configuration menu
    Copy the full SHA
    c7e44d1 View commit details
    Browse the repository at this point in the history
  7. Fix compile errors

    mrcnski committed May 1, 2023
    Configuration menu
    Copy the full SHA
    dc0e9c9 View commit details
    Browse the repository at this point in the history
  8. Fix compile error

    mrcnski committed May 1, 2023
    Configuration menu
    Copy the full SHA
    67994f5 View commit details
    Browse the repository at this point in the history

Commits on May 2, 2023

  1. Update roadmap/implementers-guide/src/node/utility/candidate-validati…

    …on.md
    
    Co-authored-by: Andrei Sandu <54316454+sandreim@users.noreply.github.com>
    mrcnski and sandreim committed May 2, 2023
    Configuration menu
    Copy the full SHA
    181e89f View commit details
    Browse the repository at this point in the history
  2. Address comments + couple other changes (see message)

    - Measure the CPU time in the prepare thread, so the observed time is not
      affected by any delays in joining on the thread.
    
    - Measure the full CPU time in the execute thread.
    mrcnski committed May 2, 2023
    Configuration menu
    Copy the full SHA
    df22727 View commit details
    Browse the repository at this point in the history
  3. Implement proper thread synchronization

    Use condvars i.e. `Arc::new((Mutex::new(true), Condvar::new()))` as per the std
    docs.
    
    Considered also using a condvar to signal the CPU thread to end, in place of an
    mpsc channel. This was not done because `Condvar::wait_timeout_while` is
    documented as being imprecise, and `mpsc::Receiver::recv_timeout` is not
    documented as such. Also, we would need a separate condvar, to avoid this case:
    the worker thread finishes its job, notifies the condvar, the CPU thread returns
    first, and we join on it and not the worker thread. So it was simpler to leave
    this part as is.
    mrcnski committed May 2, 2023
    Configuration menu
    Copy the full SHA
    5223995 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    d4eb740 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    850d2c0 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    5885222 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    4f8f1cc View commit details
    Browse the repository at this point in the history
  8. Merge remote-tracking branch 'origin/mrcnski/pvf-catch-panics-in-exec…

    …ution' into mrcnski/pvf-catch-panics-in-execution
    mrcnski committed May 2, 2023
    Configuration menu
    Copy the full SHA
    87437b8 View commit details
    Browse the repository at this point in the history
  9. Address review comments

    mrcnski committed May 2, 2023
    Configuration menu
    Copy the full SHA
    f4c0b4b View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    883952c View commit details
    Browse the repository at this point in the history

Commits on May 3, 2023

  1. Add a doc

    mrcnski committed May 3, 2023
    Configuration menu
    Copy the full SHA
    cc89ab8 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1967ddb View commit details
    Browse the repository at this point in the history
  3. Small refactor

    mrcnski committed May 3, 2023
    Configuration menu
    Copy the full SHA
    6e7a13c View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    566a438 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    660dadd View commit details
    Browse the repository at this point in the history
  6. Fix comment

    mrcnski committed May 3, 2023
    Configuration menu
    Copy the full SHA
    187528c View commit details
    Browse the repository at this point in the history
  7. Add a log

    mrcnski committed May 3, 2023
    Configuration menu
    Copy the full SHA
    6d7cbf0 View commit details
    Browse the repository at this point in the history
  8. Fix test

    mrcnski committed May 3, 2023
    Configuration menu
    Copy the full SHA
    a2d0c72 View commit details
    Browse the repository at this point in the history

Commits on May 4, 2023

  1. Update variant naming

    mrcnski committed May 4, 2023
    Configuration menu
    Copy the full SHA
    6c54e42 View commit details
    Browse the repository at this point in the history

Commits on May 16, 2023

  1. Configuration menu
    Copy the full SHA
    7da8cdf View commit details
    Browse the repository at this point in the history
  2. Address a missed TODO

    mrcnski committed May 16, 2023
    Configuration menu
    Copy the full SHA
    da7d191 View commit details
    Browse the repository at this point in the history