-
Notifications
You must be signed in to change notification settings - Fork 628
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
"malloc_consolidate(): unaligned fastbin chunk detected" when attempting to block single-threaded tokio runtime #2863
Comments
Maybe related: #2781 |
Pushed another commit into above branch with a lot of code and dependencies removed, while still reproducing an issue. There are 2 Also if replacing result_receiver.await.unwrap();
Ok(()) Then I'm getting following interesting error:
Which might be of interest as well. |
Tried again today and the error is slightly different:
I guess might be related to side-effects of incremental compilation. |
@taiki-e I was able to reduce it to this: #[test]
fn basic() {
use futures::stream::FuturesUnordered;
use std::future::Future;
use std::pin::Pin;
use std::task::{Context, Poll};
struct BadFuture;
impl Drop for BadFuture {
fn drop(&mut self) {
panic!()
}
}
impl Future for BadFuture {
type Output = ();
fn poll(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Self::Output> {
Poll::Pending
}
}
FuturesUnordered::default().push(BadFuture);
} Note that for some reason it only segfaults in a test, not when used in |
Thanks for the repro. If the problem is that we are not properly handling buggy futures that cause panic on drop, then all we may really be able to do is leak the rest on panic or convert panic to abort. |
I would have expected panic to be propagated further somehow, but I don't know the underlying reason why this is happening |
Originally reported as tokio-rs/tokio#6452, but I think this might be a
futures
problem actually.I created a (non-minimal unfortunately) reproduction branch where last commit is showing an issue:
https://github.com/subspace/subspace/tree/futures-malloc_consolidate-reproduction
On Linux it looks like this:
Here is a backtrace I collected originally:
The change in last commit is actually incorrect and causes panic, specifically this code is not allowed to block in single-threaded tokio runtime:
I expected to see a panic, but getting memory issues instead.
As shown in tokio-rs/tokio#6452 (comment) the likely cause is
futures
crate,FuturesUnordered
to be specific.The text was updated successfully, but these errors were encountered: