-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
How to close a server? #127
Comments
thriftpy2/thriftpy2/transport/socket.py Line 219 in b78720e
It seems the thread is blocking here, waiting for the socket to accept something. |
I came across this similar issue on the deprecated project page, Thriftpy/thriftpy#295. If I kill the transport and the socket I can get the threat to terminate, however, it does so by raising an exception. def stop_button_clicked(self):
server.close()
server.trans.close() # <-- kill this
server.trans.sock.close() # <-- kill this, Exception is raised
self.thd.join() # need to wrap in try-except to finish tear down
self.server = None
self.thd = None What would you like to do? Shall I prepare a pull request? |
Hanging in |
Another way to solve this is you can set a timeout on server socket like this: |
Thanks for the comments both! So there must be a client connection still open, otherwise the server should close? Setting the timeout on the socket is a much better way to go. |
I want to start and stop a thriftpy2 service from inside a running desktop application. However, calling
close
on the server does not terminate it’s thread and the application hangs.For example,
Maybe I am doing something wrong?
I’m using Python 3.6.9 and thriftpy2 0.4.10 on Windows 10.
The text was updated successfully, but these errors were encountered: