Completed QUIC streams remain registered and can OOM-kill the server

Open
#48 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
c
Domain
networking

Research direction

Start with the stream insertion and release callback in src/quic.c, then inspect connection cleanup in src/connection.c and how picoquic signals transport release. Reproduce the reported repeated unidirectional stream case and check existing stream lifecycle tests. Done means terminal streams no longer accumulate per connection while late events remain safe.

Written by the indexing model from the issue text.

Description

Summary

Completed peer-created streams remain in imquic_connection.streams after
picoquic releases them. Because stream credit is returned, one remote client
can repeat this indefinitely on one connection until the process is OOM-killed.

Runtime-tested target: unreleased main snapshot
e4e575191396ebd586cfe25d8317cd65a70bc0f9. The relevant source remains
unchanged at be40625bcb08119a351e38d48ceddc4450f71b18.

Required conditions

  • The server exposes raw QUIC.
  • The client completes one normal handshake and keeps the connection alive.
  • It repeatedly opens client-initiated unidirectional streams and sends FIN.

No malformed frame, non-default transport parameter, custom handler, or
connection flood is required.

Root cause

Streams are inserted into the connection map,
but the release callback only drops the mapping reference.
The map is reclaimed only when the parent connection is freed.

Reproduction and result

With a 4 GiB memory+swap limit, one connection sent 25,000,000 acknowledged
empty unidirectional streams. Both fresh victims were OOM-killed with exit
137 in 33.750 and 34.639 seconds; the client sent about 167.7 MB.

Matched controls sent 170 MB through one stream. Both remained healthy,
passed all 22/22 probes, and peaked near 2.13 MiB RSS.

Impact

One remote client can terminate the server process and disconnect all users.

Suggested fix

Remove terminal streams from the connection map after transport release. If
late-event suppression is needed, retain only a bounded tombstone.

Dominant language
C
Stars
84
Forks
17
Avg merge
2h 9m
Merged PRs (30d)
1

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No 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.

More from meetecho/imquic

All issues in meetecho/imquic

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.