mirror of
https://github.com/torproject/stem.git
synced 2025-03-02 06:45:29 +00:00

I spent a few hours investigating the root cause but no luck. When closing a unix socket that has been terminated by the other end our closed_wait() method raises a BrokenPipeError. In the following test this causes us to fail to reconnect the socket (because reconnection first closes us). This only happens with a ControlSocket (ie. our RUN_SOCKET test target). ====================================================================== ERROR: test_pre_disconnected_query ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/atagar/Desktop/stem/test/require.py", line 75, in wrapped return func(self, *args, **kwargs) File "/home/atagar/Desktop/stem/stem/util/test_tools.py", line 701, in wrapper result = loop.run_until_complete(func(*args, **kwargs)) File "/home/atagar/Python-3.7.0/Lib/asyncio/base_events.py", line 568, in run_until_complete return future.result() File "/home/atagar/Desktop/stem/test/integ/response/protocolinfo.py", line 122, in test_pre_disconnected_query self.assert_matches_test_config(protocolinfo_response) File "/home/atagar/Desktop/stem/stem/socket.py", line 293, in __aexit__ await self.close() File "/home/atagar/Desktop/stem/stem/socket.py", line 203, in close await self._close_wo_send_lock() File "/home/atagar/Desktop/stem/stem/socket.py", line 215, in _close_wo_send_lock await self._writer.wait_closed() File "/home/atagar/Python-3.7.0/Lib/asyncio/streams.py", line 323, in wait_closed await self._protocol._closed File "/home/atagar/Desktop/stem/test/integ/response/protocolinfo.py", line 121, in test_pre_disconnected_query protocolinfo_response = await stem.connection.get_protocolinfo(control_socket) File "/home/atagar/Desktop/stem/stem/connection.py", line 1077, in get_protocolinfo await controller.connect() File "/home/atagar/Desktop/stem/stem/socket.py", line 181, in connect await self._close_wo_send_lock() File "/home/atagar/Desktop/stem/stem/socket.py", line 215, in _close_wo_send_lock await self._writer.wait_closed() File "/home/atagar/Python-3.7.0/Lib/asyncio/streams.py", line 323, in wait_closed await self._protocol._closed File "/home/atagar/Python-3.7.0/Lib/asyncio/selector_events.py", line 868, in write n = self._sock.send(data) BrokenPipeError: [Errno 32] Broken pipe
Stem (Python Tor Library)
Stem is a Python controller library for Tor. With it you can use Tor's control protocol to script against the Tor process, or build things such as Nyx.
Documentation and tutorials available at stem.torproject.org.
Description
Languages
Python
97.5%
Roff
2.5%