Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

close TSocket socket after server disconnect #183

merged 2 commits into from
Dec 20, 2021


Copy link

@pawl pawl commented Dec 17, 2021

This is similar to: redis/redis-py#1797

Currently, TSocket.close() won't continue to close the socket if it encounters an OSError on socket.shutdown. An OSError can happen on socket.shutdown if the server side of the connection disconnected already. Not running socket.close prevents garbage collection from cleaning up the socket and will use more memory than necessary (maybe even causing a leak?).

This PR puts a separate try/except around socket.close and socket.shutdown to allow the socket to be closed after a failed shutdown.

Copy link

ethe commented Dec 17, 2021


@ethe ethe merged commit f386238 into Thriftpy:master Dec 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants