hyperium / hyperium/hyper

memory leak when processing h2 protocol requests

Open
#2,924 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug
Dominant language
Rust
Stars
16.3k
Forks
1.8k
Avg merge
1d 22h
Merged PRs (30d)
14

Description

when hyper process h2 protocol requests with large body,memory keeps increasing.I dump two jeprof.out.x.x.m2.heap,compare them,find _$LT$h2..codec..framed_read..FramedRead$LT$T$GT$$u20$as$u20$futures_core..stream..Stream$GT$::poll_next::hd05c05a51fa46d93 malloc most memory,and not free.

0.0 0.0% 100.0% 1361.2 89.8% 0x000056341f367654 bytes::bytes_mut::BytesMut::reserve_inner::hfde02843ef3655ca + 132 in section .text
0.0 0.0% 100.0% 1436.7 94.7% 0x000056341e389a87 _$LT$h2..codec..framed_read..FramedRead$LT$T$GT$$u20$as$u20$futures_core..stream..Stream$GT$::poll_next::hd05c05a51fa46d93 + 1687 in section

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 by investigating h2::codec::framed_read::FramedRead::poll_next and the BytesMut::reserve_inner allocation shown in the heap profiles. Reproduce processing h2 requests with a large body, compare heap usage across dumps, and consider the issue done when the request workload no longer causes memory to grow without release.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.