--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+unsubscribe@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/7bef9f00-c9fa-4cdc-91c7-c3555c177c9a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
gRPC Python sets the SO_REUSEADDR option on server sockets, which allows multiple servers to bind to the same port.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
On Tue, 5 Sep 2017 at 6:44 am, Ken Payson <kpa...@google.com> wrote:gRPC Python sets the SO_REUSEADDR option on server sockets, which allows multiple servers to bind to the same port.Thanks. Is there any reason why this is set to be the default behavior?
On Tue, Sep 5, 2017 at 9:02 AM Amit Saha <amits...@gmail.com> wrote:On Tue, 5 Sep 2017 at 6:44 am, Ken Payson <kpa...@google.com> wrote:gRPC Python sets the SO_REUSEADDR option on server sockets, which allows multiple servers to bind to the same port.Thanks. Is there any reason why this is set to be the default behavior?Searching around, I can see that this *may* be desired behavior and hence gRPC has made a pragmatic choice. However, it seems to be most useful in a scenario where an existing socket is in the TIME_WAIT state and we want a new server process to bind to the same addr/port. However, two questions:
1. This is not the case here - both of my servers are in LISTEN
2. Next, considering (1), does it not introduce a race condition when we have more than one process listening on the same socket? (let's say for whatever reason, a server process is already running and we have started another unaware, since we don't get an error).
grpc.server(thread_pool, options=(('grpc.so_reuseport', 0),))
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+unsubscribe@googlegroups.com.
On Tue, Sep 5, 2017 at 6:07 AM, Amit Saha <amits...@gmail.com> wrote:On Tue, Sep 5, 2017 at 9:02 AM Amit Saha <amits...@gmail.com> wrote:On Tue, 5 Sep 2017 at 6:44 am, Ken Payson <kpa...@google.com> wrote:gRPC Python sets the SO_REUSEADDR option on server sockets, which allows multiple servers to bind to the same port.Thanks. Is there any reason why this is set to be the default behavior?Searching around, I can see that this *may* be desired behavior and hence gRPC has made a pragmatic choice. However, it seems to be most useful in a scenario where an existing socket is in the TIME_WAIT state and we want a new server process to bind to the same addr/port. However, two questions:1. This is not the case here - both of my servers are in LISTENI think you are referring to the SO_REUSEPORT option. The SO_REUSEADDR is different, and is intended for having multiple processes bind to the same port. One advantage of this is that you can scale by having multiple processes serving requests.
2. Next, considering (1), does it not introduce a race condition when we have more than one process listening on the same socket? (let's say for whatever reason, a server process is already running and we have started another unaware, since we don't get an error).If you want to avoid this behavior, you can disable it by passing a server option:grpc.server(thread_pool, options=(('grpc.so_reuseport', 0),))
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
On Wed, 6 Sep 2017 at 5:40 am, Ken Payson <kpa...@google.com> wrote:On Tue, Sep 5, 2017 at 6:07 AM, Amit Saha <amits...@gmail.com> wrote:On Tue, Sep 5, 2017 at 9:02 AM Amit Saha <amits...@gmail.com> wrote:On Tue, 5 Sep 2017 at 6:44 am, Ken Payson <kpa...@google.com> wrote:gRPC Python sets the SO_REUSEADDR option on server sockets, which allows multiple servers to bind to the same port.Thanks. Is there any reason why this is set to be the default behavior?Searching around, I can see that this *may* be desired behavior and hence gRPC has made a pragmatic choice. However, it seems to be most useful in a scenario where an existing socket is in the TIME_WAIT state and we want a new server process to bind to the same addr/port. However, two questions:1. This is not the case here - both of my servers are in LISTENI think you are referring to the SO_REUSEPORT option. The SO_REUSEADDR is different, and is intended for having multiple processes bind to the same port. One advantage of this is that you can scale by having multiple processes serving requests.Sorry, but whatever I read seems to suggest the behavior you mention for SO_REUSEPORT and not SO_REUSEADDR. I will definitely look more, but if you have a handy reference you can share, that will be great.