On Tue, 5 Sep 2017 at 6:44 am, Ken Payson <kpay...@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 Mon, Sep 4, 2017 at 5:58 AM, Amit Saha <amitsaha...@gmail.com> wrote: > >> Hey all, >> >> This is the relevant part of my server: >> >> def serve(): >> server = grpc.server(futures.ThreadPoolExecutor(max_workers=10)) >> users_service.add_UsersServicer_to_server(UsersService(), server) >> res = server.add_insecure_port('127.0.0.1:50051') >> server.start() >> try: >> while True: >> time.sleep(_ONE_DAY_IN_SECONDS) >> except KeyboardInterrupt: >> server.stop(0) >> >> >> On OS X, by mistake i started the server twice in different terminal >> sessions and I expected it to fail the second time (address already bound, >> etc). However, it didn't error out and this is what I see via lsof: >> >> $ sudo lsof -iTCP:50051 >> >> COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME >> Python 12120 amit 4u IPv6 0xffbffb1742aa0f0f 0t0 TCP >> localhost:50051 (LISTEN) >> Python 12157 amit 4u IPv6 0xffbffb1742aa144f 0t0 TCP >> localhost:50051 (LISTEN) >> >> Curiously enough, they both have the same FD. >> >> (I verified it with a Flask application to see if it was something Python >> specific, and i do see the expected error message when I try to start a >> second instance of the same) >> >> Thanks for any hints in advance. >> >> Best Wishes, >> Amit. >> >> -- >> 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+unsubscr...@googlegroups.com. > > >> To post to this group, send email to grpc-io@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 >> <https://groups.google.com/d/msgid/grpc-io/7bef9f00-c9fa-4cdc-91c7-c3555c177c9a%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- 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+unsubscr...@googlegroups.com. To post to this group, send email to grpc-io@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/CANODV3k2ywXm3WWCpFOn7Mez5vZefamPsa_A-njnN_g2uck0wA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.