-
-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TimedOut error when has_broken = true #167
Comments
I also found out that
The output is:
|
Another update, it seems to be a concurrency bug, waiting a few milliseconds before spawning the next concurrent
|
Is there a regression here? If so, I suspect #153 might be at fault... |
I am not sure, I started using bb8 this week probably after #153 had been merged. |
Hi @mdecimus, thanks for the bug report! Your findings on @djc I've confirmed that this bug still reproduces before #153 was merged, it fails identically way back on 709137f which was the arbitrary old commit I picked to check. It's interesting, there's definitely a timing aspect here. I can trigger/not trigger the issue with this code on the loop: let pause_on = 5;
let delay = 2;
for i in 0..6 {
if i == pause_on { tokio::time::sleep(Duration::from_millis(delay)).await; }
let pool = pool.clone();
futures.push(tokio::spawn(async move {
let conn = pool.get().await.unwrap();
drop(conn);
}));
} This test will pass with a value of |
I did some debugging based on the test case provided in the issue.
I'm not quite sure how to solve this best, I'd be happy to write up a PR if you have any ideas @djc |
Adding a call to
This would only notify active waiters, they wake up, and see that there's now an available slot. The provided test case passes with this change. It might be a good idea to do this in |
@xortive thanks for looking into this! Would you be able to submit a PR with both a regression unit test and your proposed fix? Would make it a bit easier for me to review in context. |
Hi,
I found what seems to be a bug. When multiple connections return
true
onhas_broken()
, all future requests toget()
fail with aTimedOut
error. This code can be used to reproduce the problem:The text was updated successfully, but these errors were encountered: