Skip to content

close_connection doesn't close() because sock.shutdown crashes first. #259

Description

@EternityForest

When using cherrypy and ssl, for reasons I don't understand, the sock.shutdown call throws this error occasionally(When the source is modified to print tracebacks instead of silently pass).

Traceback (most recent call last):
  File "/home/daniel/Projects/KaithemAutomation/kaithem/src/thirdparty/ws4py/websocket.py", line 210, in close_connection
    self.sock.shutdown(socket.SHUT_RDWR)
  File "/usr/lib/python3.6/ssl.py", line 1050, in shutdown
    socket.shutdown(self, how)
OSError: [Errno 107] Transport endpoint is not connected

Seeing as how this is in the same try/except block as socket.close(), I presume that socket.close() is not always being called. Because of circular refs it might or might not get GCed right away, and if it does not, it may have something to do with some of the remaining bad behavior.

I will be testing with giving shutdown it's own try/except block and seeing how that goes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions