Comment 6 for bug 1849971

Revision history for this message
Olaf Seibert (rhialto) wrote :

There may be some race condition involved. I added a check for sock._closed, and still the EINVAL came in one case.

Code as tested:

    def shutdown_socket(self, sock):
        """Properly shutdown a socket.

        This should be called only when no other thread is trying to use the
        if not sock._closed:
                # import pdb; pdb.set_trace()
                sock.shutdown(socket.SHUT_RDWR) # fails with EINVAL
            except Exception as e:
                import pdb; pdb.set_trace()
                if self.ignored_exceptions(e):

...x.test_commit.TestCommit.test_verbose_commit_with_unchanged OK 128ms OK 281ms
..._commit.TestCommit.test_warn_about_forgotten_commit_message OK 78ms
...est_commit.TestSmartServerCommit.test_commit_to_lightweight> /home/tmp/devel/breezy/work.x86_64/breezy-3.0.1/breezy/tests/
-> if self.ignored_exceptions(e):
(Pdb) e
OSError(22, 'Invalid argument')
(Pdb) sock
<socket.socket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0>
(Pdb) sock._closed