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

Intermittent hangs #5

Open
v1gnesh opened this issue Aug 1, 2024 · 6 comments
Open

Intermittent hangs #5

v1gnesh opened this issue Aug 1, 2024 · 6 comments

Comments

@v1gnesh
Copy link

v1gnesh commented Aug 1, 2024

Firstly, thank you for sharing your work ❤️

Inside a tokio async main, I'm using it like this:

use futures_buffered::BufferedStreamExt;


let mut stream = framed_read_stream
    .map(|x| do_stuff(x))
    .buffered_ordered(4096);

while let Some(recvd) = stream.next().await {
}

It just seems to hang, like 80% of the time (i.e., 80% of the time I run the program). How do I debug this?

@conradludgate
Copy link
Owner

Curious. Do you happen to know what operation "do_stuff" gets stuck on specifically?

@conradludgate
Copy link
Owner

Although it shouldn't matter here, there is a bug with BufferedOrdered I've just found where the size_hint is incorrec:

_ => (0, Some(0)),

@v1gnesh
Copy link
Author

v1gnesh commented Aug 1, 2024

do_stuff creates a tx rx pair, spawns tasks into a pre-created rayon global thread pool giving it the tx, then returns the rx.
So stream is a Stream of Receivers.

@conradludgate
Copy link
Owner

I think I found a subtle race condition in the waker implementation. Just published a potential fix

@v1gnesh
Copy link
Author

v1gnesh commented Aug 11, 2024

Still stalls :(
Works with buffered(1) but you might expect that to work already.

@conradludgate
Copy link
Owner

conradludgate commented Aug 12, 2024

Hmm. Unfortunate. I guess I'll keep digging. I've not been able to reproduce any stalls myself yet

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

2 participants