Python insecure channel doesn't close properly when Exception is raised

170 views
Skip to first unread message

ke...@conti-x.com

unread,
May 18, 2016, 8:21:31 PM5/18/16
to grpc.io
I've been writing a GRPC client using the Python library, but I'm having some issues with the connection not being closed.  Here's a quick example:

from grpc.beta import implementations

from grpc.framework import interfaces

from dummy_pb2 import *


def main():

    channel = implementations.insecure_channel('localhost', 8000)

    stub = beta_create_Dummy_stub(channel)

    raise Exception()


if __name__ == "__main__":

    main()


This code will hang after raising the Exception.  However, this only seems to happen when an Exception is raised.  If I remove the statement to raise the Exception, the code exits cleanly.  Is there some issue with Python GRPC's cleanup when exceptions occur? 

Nathaniel Manista

unread,
May 20, 2016, 12:00:05 PM5/20/16
to ke...@conti-x.com, grpc.io
That is odd. I have some changes landing soon that I suspect will fix it but in the meantime I've filed issue 6666 to track the problem.
-Nathaniel
Reply all
Reply to author
Forward
0 new messages