Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

wanted: ability to listen on existing socket/fd #1166

Open
benfleis opened this issue Aug 17, 2015 · 4 comments
Open

wanted: ability to listen on existing socket/fd #1166

benfleis opened this issue Aug 17, 2015 · 4 comments

Comments

@benfleis
Copy link
Contributor

In order to implement zero-downtime process rollover, I would like to have to the ability to listen on an existing fd, a la server.listen({ fd: 0 }) API [1]. I have a WIP diff for node/js, which will shortly be added.

[1] https://nodejs.org/api/net.html#net_server_listen_handle_callback

@jcorbin
Copy link
Contributor

jcorbin commented Aug 17, 2015

Can you please lay out details on one or more use cases? I think I understand how you intend to use this, but I want to be sure.

@Raynos
Copy link
Contributor

Raynos commented Aug 17, 2015

The main use case is passing a listening fd from one server to another with a low amount of downtime.

You want to be able to start a new instance of a worker and only close the old listening socket once the new instance has listened. This is useful if your process takes seconds to start.

@jcorbin
Copy link
Contributor

jcorbin commented Aug 17, 2015

I get that @Raynos, but I still would like more clarity on an example of how this gets used in practice.

@benfleis
Copy link
Contributor Author

@jcorbin

This is how I intend to actually use it. (crank might be replaced with a supervisord plugin module, but that has other risks.)

  • supervisord spawns crank process
  • crank maintains an open, listenable socket/fd on configured port
  • crank spawns ringpop-app

On upgrade:

  • untar new package
  • signal to crank, which in turn
  • spawns new ringpop-app with handoff FD, after which
  • old ringpop-app is killed

Make sense?

Crank could be socketmaster (which is time based), or for nodejs, I already have a cluster-based approach to doing the same.

benfleis pushed a commit to benfleis/tchannel that referenced this issue Aug 19, 2015
.listen. conceptually identical to same patch for master (v2.x).

addresses uber#1166
benfleis pushed a commit to benfleis/tchannel that referenced this issue Aug 20, 2015
.listen. conceptually identical to same patch for master (v2.x).

has proper listen-on-fd test via child_process.

addresses uber#1166
benfleis added a commit that referenced this issue Aug 20, 2015
(v1.x) add support to listen on socket/fd, via options argument to .listen. conceptually identical to same patch for master (v2.x).

has proper listen-on-fd test via child_process.

addresses #1166
benfleis pushed a commit to benfleis/tchannel that referenced this issue Aug 21, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants