On Fri, Jun 2, 2017 at 12:12 PM, <[email protected]> wrote:

> In Python, how can find out if the port I'm trying to use for my gRPC
> server is already in use? I need to add the port before starting the
> server, but if I add a port already in use, it starts without any errors.
>
> I'm running Python 2.7 on CentOS 7.
>

I've confirmed your observation.

Did you see any error logging? Possibly something like '"description":"No
address added out of total 1 resolved"'?

It looks like the problem is in gRPC Python. The gRPC Core tells us that a
return value of zero indicates that the port addition was not successful
<https://github.com/grpc/grpc/blob/01b536c3e74609273ec4042ddb158be32c3fc6c7/include/grpc/grpc.h#L387-L391>,
but gRPC Python does not examine the Core's return value before passing it
to the application
<https://github.com/grpc/grpc/blob/01b536c3e74609273ec4042ddb158be32c3fc6c7/src/python/grpcio/grpc/_server.py#L655>.
I'm not sure if the right fix is to advertise to applications that a return
value of zero indicates a failure
<https://github.com/grpc/grpc/blob/01b536c3e74609273ec4042ddb158be32c3fc6c7/src/python/grpcio/grpc/__init__.py#L976-L978>
or to raise an exception. Which might you prefer?
<https://github.com/grpc/grpc/issues/11394>

Thanks for the report,
-Nathaniel

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/CAEOYnATXwY8eVtzsRzBHQ3844n5o_srZjdahzgg0H_%3DXo8nz-Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to