Open kornelski opened 3 years ago
Is there any chance of making Bytes support fallible allocations? e.g. try_reserve()? This can be done on stable using allocator APIs.
Bytes
try_reserve()
Contrary to a popular belief, Rust can run out of memory, and a crash in hyper/h1 that uses BytesMut is one that I can't fix myself:
BytesMut
frame #4: 0x000055ed3d75e1fe proxy`rust_oom at alloc.rs:331 frame #5: 0x000055ed3d777997 proxy`__rg_oom at alloc.rs:409 frame #6: 0x000055ed3d777987 proxy`alloc::alloc::handle_alloc_error::hff9c7b75d4b02d59 at alloc.rs:363 frame #7: 0x000055ed3d6df552 proxy`alloc::raw_vec::RawVec$LT$T$C$A$GT$::reserve::hf9df86148f278508 [inlined] alloc::raw_vec::handle_reserve::h852aba6b1ef87537 at raw_vec.rs:515 frame #8: 0x000055ed3d6df544 proxy`alloc::raw_vec::RawVec$LT$T$C$A$GT$::reserve::hf9df86148f278508 at raw_vec.rs:311 frame #9: 0x000055ed3d6def01 proxy`bytes::bytes_mut::BytesMut::reserve_inner::ha538bdeb84ed3317 [inlined] alloc::vec::Vec$LT$T$GT$::reserve::hbcc72a1bb27b195d at vec.rs:505 frame #10: 0x000055ed3d6deef6 proxy`bytes::bytes_mut::BytesMut::reserve_inner::ha538bdeb84ed3317 at bytes_mut.rs:584 frame #11: 0x000055ed3ce62068 proxy`hyper::proto::h1::io::Buffered$LT$T$C$B$GT$::poll_read_from_io::h10aec5e55317b2ff [inlined] bytes::bytes_mut::BytesMut::reserve::h1bae842ad2da6364 at bytes_mut.rs:548 frame #12: 0x000055ed3ce6205f proxy`hyper::proto::h1::io::Buffered$LT$T$C$B$GT$::poll_read_from_io::h10aec5e55317b2ff at io.rs:189
I didn't see this comment when it was first posted, but it seems reasonable to me.
fwiw.. RUST does not run out of memory. Rather a recall issue under specific circumstances/instances. All the best
Is there any chance of making
Bytes
support fallible allocations? e.g.try_reserve()
? This can be done on stable using allocator APIs.Contrary to a popular belief, Rust can run out of memory, and a crash in hyper/h1 that uses
BytesMut
is one that I can't fix myself: