axiom icon indicating copy to clipboard operation
axiom copied to clipboard

Race-Condition in Aid::send() method

Open mineichen opened this issue 5 years ago • 0 comments

Sending multiple messages might not be scheduled, if two threads send a message to the sender simultanously. If a context switch happens between sending and checking the receivable-count, the counter might never be 1 and will therefore never be scheduled to the executor.

match sender.send_await_timeout(message, system.config().send_timeout) {
    Ok(_) => {
        if sender.receivable() == 1 {
            system.schedule(self.clone());
        };
        Ok(())
    }
    Err(_) => Err(AidError::SendTimedOut(self.clone())),
}

mineichen avatar Nov 17 '20 20:11 mineichen