hyperium / hyperium/hyper

Provide way to catch OOM in C API

Open
#2,396 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

A-ffi B-upstream
Dominant language
Rust
Stars
16.3k
Forks
1.8k
Avg merge
1d 22h
Merged PRs (30d)
14

Description

Currently, allocation errors automatically result in an abort, which is undesirable in the C API. We could look into using std::alloc::set_alloc_error_hook or similar, to override the default behavior so that it doesn't abort, but does some sort of panic!(HyperOom), and we catch that at the FFI boundary (like all panics). However, that is not a stable function. First step is likely to get libstd to stabilize something we can use.

Originally from https://github.com/hyperium/hyper/issues/2265#issuecomment-694508481

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the C API and its FFI boundary, then investigate std::alloc::set_alloc_error_hook and the existing panic-catching behavior described in the issue. Confirm whether a stable libstd mechanism exists; done means allocation failure no longer aborts through the C API and is handled at the FFI boundary.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.