Don't hold GIL during Flight server shutdown

This commit is contained in:
David Li committed 2019-05-03 14:21:00 -04:00
1 parent a1829b32c7
commit 0e61111541
1 file changed
+7 -2
+7 -2
View File
@@ -972,5 +972,10 @@ cdef class FlightServerBase:
request to finish. Instead, call this method from a background
thread.
"""
if self.server.get() != NULL:
self.server.get().Shutdown()
# Must not hold the GIL: shutdown waits for pending RPCs to
# complete. Holding the GIL means Python-implemented Flight
# methods will never get to run, so this will hang
# indefinitely.
with nogil:
if self.server.get() != NULL:
self.server.get().Shutdown()