embassy-rs / teleprobe

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deadlock issue caused by timeout mutex locks

badrbouslikhin opened this issue · comments

Hello,

I'm experiencing issues with the mutex locks, as it appears to be causing a deadlock. Here's the code snippet that triggers the problem:

let timeout_secs = args
.timeout
.unwrap_or(cx.lock().config.default_timeout)
.min(cx.lock().config.max_timeout);
let timeout = Duration::from_secs(timeout_secs);

To resolve the issue, I made the following change:

let default_timeout = cx.lock().config.default_timeout;
let max_timeout = cx.lock().config.max_timeout;
let timeout_secs = args.timeout.unwrap_or(default_timeout).min(max_timeout);

This modification seems to fix the problem. Would you like me to open a pull request to implement this change?

Yes please.

Strange that it works for me though. Huh.