dabeaz / curio

Good Curio!
Other
4.02k stars 241 forks source link

Problem with socket, OSError: [Errno 107] Transport endpoint is not connected #226

Closed wku closed 7 years ago

wku commented 7 years ago

import asks import curio async def example():

r = await asks.get('https://ya.ru')#does not work
# r = await asks.get('https://yandex.ru')#does not work
# r = await asks.get('https://auto.ru')#does not work

# r = await asks.get('https://www.bing.com/') #works correctly
# r = await asks.get('https://google.com') #works correctly

print(r.content)

curio.run(example())

wku@wku:~/test$ python main.py Task 2 crashed Traceback (most recent call last): File "/home/wku/anaconda3/lib/python3.6/site-packages/curio/kernel.py", line 826, in _run_coro trap = current._send(current.next_value) File "/home/wku/anaconda3/lib/python3.6/site-packages/curio/task.py", line 96, in _task_runner return await coro File "main.py", line 5, in example r = await asks.get('https://ya.ru') File "/home/wku/anaconda3/lib/python3.6/site-packages/asks/base_funcs.py", line 29, in request r = await s.request(method, url=uri, kwargs) File "/home/wku/anaconda3/lib/python3.6/site-packages/asks/sessions.py", line 139, in request sock = await self._grab_connection(url) File "/home/wku/anaconda3/lib/python3.6/site-packages/asks/sessions.py", line 382, in _grab_connection sock = await self._make_connection(host_loc) File "/home/wku/anaconda3/lib/python3.6/site-packages/asks/sessions.py", line 355, in _make_connection sock, port = await self._connect(host_loc=host_loc) File "/home/wku/anaconda3/lib/python3.6/site-packages/asks/sessions.py", line 70, in _connect (netloc, int(port))), port File "/home/wku/anaconda3/lib/python3.6/site-packages/asks/sessions.py", line 49, in _open_connection_https server_hostname=location[0]) File "/home/wku/anaconda3/lib/python3.6/site-packages/curio/network.py", line 74, in open_connection sock = await _wrap_ssl_client(sock, ssl, server_hostname, alpn_protocols) File "/home/wku/anaconda3/lib/python3.6/site-packages/curio/network.py", line 58, in _wrap_ssl_client await sock.do_handshake() File "/home/wku/anaconda3/lib/python3.6/site-packages/curio/io.py", line 282, in do_handshake return self._socket.do_handshake() File "/home/wku/anaconda3/lib/python3.6/ssl.py", line 1056, in do_handshake self._check_connected() File "/home/wku/anaconda3/lib/python3.6/ssl.py", line 855, in _check_connected self.getpeername() OSError: [Errno 107] Transport endpoint is not connected Traceback (most recent call last): File "/home/wku/anaconda3/lib/python3.6/site-packages/curio/kernel.py", line 826, in _run_coro trap = current._send(current.next_value) File "/home/wku/anaconda3/lib/python3.6/site-packages/curio/task.py", line 96, in _task_runner return await coro File "main.py", line 5, in example r = await asks.get('https://ya.ru') File "/home/wku/anaconda3/lib/python3.6/site-packages/asks/base_funcs.py", line 29, in request r = await s.request(method, url=uri, kwargs) File "/home/wku/anaconda3/lib/python3.6/site-packages/asks/sessions.py", line 139, in request sock = await self._grab_connection(url) File "/home/wku/anaconda3/lib/python3.6/site-packages/asks/sessions.py", line 382, in _grab_connection sock = await self._make_connection(host_loc) File "/home/wku/anaconda3/lib/python3.6/site-packages/asks/sessions.py", line 355, in _make_connection sock, port = await self._connect(host_loc=host_loc) File "/home/wku/anaconda3/lib/python3.6/site-packages/asks/sessions.py", line 70, in _connect (netloc, int(port))), port File "/home/wku/anaconda3/lib/python3.6/site-packages/asks/sessions.py", line 49, in _open_connection_https server_hostname=location[0]) File "/home/wku/anaconda3/lib/python3.6/site-packages/curio/network.py", line 74, in open_connection sock = await _wrap_ssl_client(sock, ssl, server_hostname, alpn_protocols) File "/home/wku/anaconda3/lib/python3.6/site-packages/curio/network.py", line 58, in _wrap_ssl_client await sock.do_handshake() File "/home/wku/anaconda3/lib/python3.6/site-packages/curio/io.py", line 282, in do_handshake return self._socket.do_handshake() File "/home/wku/anaconda3/lib/python3.6/ssl.py", line 1056, in do_handshake self._check_connected() File "/home/wku/anaconda3/lib/python3.6/ssl.py", line 855, in _check_connected self.getpeername() OSError: [Errno 107] Transport endpoint is not connected

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "main.py", line 8, in curio.run(example()) File "/home/wku/anaconda3/lib/python3.6/site-packages/curio/kernel.py", line 877, in run return kernel.run(corofunc, *args, timeout=timeout) File "/home/wku/anaconda3/lib/python3.6/site-packages/curio/kernel.py", line 214, in run raise TaskError('Task Crashed') from ret_exc curio.errors.TaskError: Task Crashed wku@wku:~/test$

wku commented 7 years ago

Yes, this is not a bug, it all works BUT NOT IN ME (

njsmith commented 7 years ago

That's a weird error message for curio to be giving. If the connection is failing it should probably report that instead of proceeding to try to run the ssl handshake.

Is your browser continued to use a proxy?

wku commented 7 years ago

The browser works without a proxy