Close listening socket on graceful shutdown

Open Beginner friendly
#2,342 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
78/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Stale
Tech stack
rust

Research direction

Open tonic/src/transport/server/mod.rs around lines 768-770 at the referenced revision and inspect the graceful-shutdown path. Confirm that dropping incoming closes the listening socket, then verify the reconnect and server-restart behavior described in the motivation. Done means the socket is no longer held after shutdown while the relevant restart behavior remains testable.

Written by the indexing model from the issue text.

Description

Feature Request

Crates

tonic

Motivation
  • listening socket will never be served, so holding it is pointless
  • but it is helpful for testing behavior like reconnecting on server restart
Proposal

In the middle of here:

https://github.com/hyperium/tonic/blob/d4e4a2aaf6de36f5018c5f854d545e0439800b80/tonic/src/transport/server/mod.rs#L768-L770

add

drop(incoming);
Alternatives

Use your own incoming and connect it to the same signal.

Dominant language
Rust
Stars
12.5k
Forks
1.3k
Avg merge
4d 7h
Merged PRs (30d)
24

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.

More from grpc/grpc-rust

All issues in grpc/grpc-rust

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.