Skip to content
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

Implement more robust #41

Closed
yoshuawuyts opened this issue Nov 9, 2022 · 1 comment
Closed

Implement more robust #41

yoshuawuyts opened this issue Nov 9, 2022 · 1 comment

Comments

@yoshuawuyts
Copy link
Owner

When debugging tuple Merge with mw we found something which hints at a potential bug in tuple Merge. The test case was as follows:

let a = stream::once(async { () });
let b = stream::once(pending());
let c = (a, b).merge();
while let Some(_) = c.next().await {
    dbg!(item);
}
println!("done");

"done" should never be able to print in this case. When doing a cargo run it never triggered, but when running it through the debugger we could see it trigger. This may hint at a race condition!

@yoshuawuyts
Copy link
Owner Author

yoshuawuyts commented Nov 9, 2022

Okay the issue was we were using futures::pending! instead of futures::future::pending. It apparently exposed "poll once" semantics, and because we don't yet have "perfect wakers", it got polled twice - meaning it would resolve after the first future resolved.

No bug in the impl, just in the way we were testing it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant