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

Fallible allocations? #484

Open
kornelski opened this issue Feb 18, 2021 · 2 comments
Open

Fallible allocations? #484

kornelski opened this issue Feb 18, 2021 · 2 comments

Comments

@kornelski
Copy link

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:

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
@Darksonn
Copy link
Contributor

I didn't see this comment when it was first posted, but it seems reasonable to me.

@reevesPAC
Copy link

fwiw.. RUST does not run out of memory. Rather a recall issue under specific circumstances/instances. All the best

Guiguiprim added a commit to Guiguiprim/bytes that referenced this issue Dec 13, 2021
Guiguiprim added a commit to Guiguiprim/bytes that referenced this issue Dec 13, 2021
Guiguiprim added a commit to JustRustThings/bytes that referenced this issue Dec 13, 2021
poliorcetics pushed a commit to JustRustThings/bytes that referenced this issue Jul 19, 2022
poliorcetics pushed a commit to JustRustThings/bytes that referenced this issue Aug 12, 2022
poliorcetics pushed a commit to JustRustThings/bytes that referenced this issue Jan 26, 2023
poliorcetics pushed a commit to JustRustThings/bytes that referenced this issue Feb 24, 2023
poliorcetics pushed a commit to JustRustThings/bytes that referenced this issue May 19, 2023
poliorcetics pushed a commit to JustRustThings/bytes that referenced this issue Sep 28, 2023
Guiguiprim added a commit to JustRustThings/bytes that referenced this issue Mar 26, 2024
Guiguiprim added a commit to JustRustThings/bytes that referenced this issue Oct 7, 2024
Guiguiprim added a commit to JustRustThings/bytes that referenced this issue Jan 3, 2025
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

Successfully merging a pull request may close this issue.

3 participants