question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ConnectionResetError: [Errno 104] Connection reset by peer

See original GitHub issue

Hi, everybody! I use torando+aioredis, and recently i met this issue, below is traceback my environ: aioredis==1.2.0 tornado==5.1.1 I use this method aioredis.create_redis_pool(**args) to create pool can anybody show me help? thx a lot.

`Traceback (most recent call last):
   File "/usr/local/lib/python3.6/site-packages/tornado/web.py", line 1699, in _execute
 result = await result
 File "/views/notice.py", line 341, in get
   items, page_size, total_page, total_size = await Notice.cache_or_api_list(notice_id_list, page_count, page_size)
 File "models/notice.py", line 136, in cache_or_api_list
   items = await cls.query_list(page_list)
 File "models/notice.py", line 92, in query_list
   items = await asyncio.gather(*[Notice.cache_or_api(notice_id) for notice_id in notice_id_list])
 File "models/notice.py", line 37, in cache_or_api
   info = await redis.execute('get', redis_key)
 File "models/notice.py", line 37, in cache_or_api
   info = await redis.execute('get', redis_key)
 File "models/notice.py", line 37, in cache_or_api
   info = await redis.execute('get', redis_key)
 [Previous line repeated 11 more times]
 File "/usr/local/lib/python3.6/site-packages/aioredis/connection.py", line 183, in _read_data
   obj = await self._reader.readobj()
 File "/usr/local/lib/python3.6/site-packages/aioredis/stream.py", line 94, in readobj
   await self._wait_for_data('readobj')
 File "/usr/local/lib/python3.6/asyncio/streams.py", line 464, in _wait_for_data
   yield from self._waiter
 File "/usr/local/lib/python3.6/asyncio/selector_events.py", line 723, in _read_ready
   data = self._sock.recv(self.max_size)
ConnectionResetError: [Errno 104] Connection reset by peer`

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:4
  • Comments:58 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
Enchufa2commented, Jan 13, 2022

Were you able to reproduce the error? If not, I think we should focus on that first. 😃 You need to find a way to reset or abort a TCP connection in macOS, or otherwise, test this into a Linux box, where you can use ss, which aborts the connection. AFAIK, there’s no equivalent in macOS. But there’s the tcpkill utility, from dsniff, which seems to work on macOS too (at least this fork).

I just tried tcpkill myself on Linux and works nicely by resetting the connection (exactly the same issue I’ve found in production). There are two things you need to do for this to work. First, launch tcpkill:

$ sudo tcpkill -i lo port 6379

Here tcpkill keeps listening the loopback interface and will reset any TCP connection to port 6379 (if your Redis host is not local, then just change the interface accordingly). And secondly, you need to force an IPv4 connection (because tcpkill doesn’t understand IPv6). Again for localhost, you just need to specify redis = Redis(host="127.0.0.1") in my test case above.

2reactions
steve-marmaladecommented, Mar 2, 2022

Now that Aioredis is in redis-py 4.2.0rc1, is the expectation that this issue will go away once we migrate to redis? Any idea when a non-rc version will be released? Thanks for all your hard work!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python handling socket.error: [Errno 104] Connection reset by ...
"Connection reset by peer" is the TCP/IP equivalent of slamming the phone back on the hook. It's more polite than merely not replying, ......
Read more >
How do I fix connectionreseterror: [errno 104] connection reset ...
ConnectionResetError : [Errno 104] Connection reset by peer (From server) traceback: Traceback (most recent call last): File "server.py", ...
Read more >
[Errno 104] Connection reset by peer - PYTHON - YouTube
PYTHON : Python handling socket.error: [ Errno 104 ] Connection reset by peer [ Gift : Animated Search Engine ...
Read more >
[errno 104] connection reset by peer - You.com
When I tried to connect to the server (which was hosted on my system) by another system connected to same LAN network, this...
Read more >
What does the '(104) Connection reset by peer' error ... - Quora
This means that a TCP RST was received and the connection is now closed. · As a user you should try to open...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found