Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

create_socket does not close socket if there is binding or listening error #949

Closed
karthiknadig opened this issue Oct 22, 2018 · 0 comments
Assignees

Comments

@karthiknadig
Copy link
Member

2018-10-15T02:21:04.4728966Z _____________ TestSocketServerReuse.test_reuse_same_address_port ______________
2018-10-15T02:21:04.4729141Z 
2018-10-15T02:21:04.4735974Z self = <pytests.test_socket.TestSocketServerReuse object at 0x0000000004847208>
2018-10-15T02:21:04.4736533Z 
2018-10-15T02:21:04.4736693Z     def test_reuse_same_address_port(self):
2018-10-15T02:21:04.4736855Z         try:
2018-10-15T02:21:04.4737021Z             sock1 = create_server(self.HOST1, self.PORT1)
2018-10-15T02:21:04.4737308Z             with pytest.raises(Exception):
2018-10-15T02:21:04.4737589Z                 create_server(self.HOST1, self.PORT1)
2018-10-15T02:21:04.4738513Z             assert sock1.getsockname() == (self.HOST1, self.PORT1)
2018-10-15T02:21:04.4739309Z         finally:
2018-10-15T02:21:04.4739463Z >           shut_down(sock1)
2018-10-15T02:21:04.4739589Z 
2018-10-15T02:21:04.4739713Z pytests\test_socket.py:21: 
2018-10-15T02:21:04.4745833Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2018-10-15T02:21:04.4746134Z ptvsd\socket.py:195: in shut_down
2018-10-15T02:21:04.4746327Z     sock.shutdown(how)
2018-10-15T02:21:04.4752192Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2018-10-15T02:21:04.4752399Z 
2018-10-15T02:21:04.4772223Z name = 'shutdown', self = <socket._socketobject object at 0x000000000476DC10>
2018-10-15T02:21:04.4772514Z args = (2,)
2018-10-15T02:21:04.4772694Z 
2018-10-15T02:21:04.4772858Z     def meth(name,self,*args):
2018-10-15T02:21:04.4773061Z >       return getattr(self._sock,name)(*args)
2018-10-15T02:21:04.4775260Z E       error: [Errno 10057] A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied
2018-10-15T02:21:04.4775366Z 
2018-10-15T02:21:04.4775546Z C:\hostedtoolcache\windows\Python\2.7.14\x64\lib\socket.py:228: error
2018-10-15T02:21:04.4785557Z _________________ TestSocketServerReuse.test_reuse_same_port __________________
2018-10-15T02:21:04.4785669Z 
2018-10-15T02:21:04.4792204Z self = <pytests.test_socket.TestSocketServerReuse object at 0x000000000436AA20>
2018-10-15T02:21:04.4792294Z 
2018-10-15T02:21:04.4792399Z     def test_reuse_same_port(self):
2018-10-15T02:21:04.4792544Z         try:
2018-10-15T02:21:04.4792788Z             sock1 = create_server(self.HOST1, self.PORT1)
2018-10-15T02:21:04.4793003Z             sock2 = create_server(self.HOST2, self.PORT1)
2018-10-15T02:21:04.4793463Z             assert sock1.getsockname() == (self.HOST1, self.PORT1)
2018-10-15T02:21:04.4793882Z             assert sock2.getsockname() == (self.HOST2, self.PORT1)
2018-10-15T02:21:04.4794083Z         finally:
2018-10-15T02:21:04.4794353Z >           shut_down(sock1)
2018-10-15T02:21:04.4794862Z E           UnboundLocalError: local variable 'sock1' referenced before assignment
2018-10-15T02:21:04.4795005Z 
2018-10-15T02:21:04.4795393Z pytests\test_socket.py:30: UnboundLocalError
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant