Message125632
Le vendredi 07 janvier 2011 à 02:19 +0000, Nadeem Vawda a écrit :
> Most of these leaks seem to stem from the fact that socket.SocketIO.close() doesn't behave as documented. According to its docstring, it is meant to decrement the underlying socket's refcount, and close it if the refcount drops to zero. However, to do this job it calls socket._decref_socketios(), which is defined as follows:
>
> def _decref_socketios(self):
> if self._io_refs > 0:
> self._io_refs -= 1
> if self._closed:
> self.close()
>
> Clearly, this doesn't do what the docstring describes. Changing the second conditional from "if self._closed:" to "if self._io_refs <= 0:" disposes of all but one of the ResourceWarnings, but also breaks 8 tests in test_socket. It seems that the tests expect a socket to remain open after all referring SocketIO objects have been closed, which contradicts the docstring for SocketIO.close(). I suppose I should open a separate issue for this.
Can you please open a new issue for that?
Victor |
|
Date |
User |
Action |
Args |
2011-01-07 09:13:14 | vstinner | set | recipients:
+ vstinner, nadeem.vawda, lukasz.langa |
2011-01-07 09:13:12 | vstinner | link | issue10512 messages |
2011-01-07 09:13:12 | vstinner | create | |
|