Skip to content

Commit

Permalink
malus: use spawn_blocking (#2804)
Browse files Browse the repository at this point in the history
Looks like using `spawn` instead of `spawn_blocking` in malus is leading
to a deadlock somehow. I'm not sure why exactly, but switching to
`spawn_blocking` fixes
paritytech/disabling-e2e-tests#1, at least for
`suggest-garbage-candidate` (didn't check other variants).

Maybe my assumption here was wrong:
#2184 (comment).

---------

Co-authored-by: Tsvetomir Dimitrov <tsvetomir@parity.io>
  • Loading branch information
ordian and tdimitrov authored Jan 2, 2024
1 parent 1dd1a16 commit 909c1e4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion polkadot/node/malus/src/variants/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ where
let _candidate_descriptor = candidate_descriptor.clone();
let mut subsystem_sender = subsystem_sender.clone();
let (sender, receiver) = std::sync::mpsc::channel();
self.spawner.spawn(
self.spawner.spawn_blocking(
"malus-get-validation-data",
Some("malus"),
Box::pin(async move {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ where

let dispute_offset = self.dispute_offset;
let mut sender = subsystem_sender.clone();
self.spawner.spawn(
self.spawner.spawn_blocking(
"malus-dispute-finalized-block",
Some("malus"),
Box::pin(async move {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ where
let (sender, receiver) = std::sync::mpsc::channel();
let mut new_sender = subsystem_sender.clone();
let _candidate = candidate.clone();
self.spawner.spawn(
self.spawner.spawn_blocking(
"malus-get-validation-data",
Some("malus"),
Box::pin(async move {
Expand Down
9 changes: 9 additions & 0 deletions prdoc/pr_2804.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
title: Fix malus implementation.

doc:
- audience: Node Dev
description: |
The malus implementation is used to test security of Polkadot.
It was broken. This fixes it.

crates: [ ]

0 comments on commit 909c1e4

Please sign in to comment.