Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexError - pop from an empty deque #9487

Closed
3 tasks done
Iinksafe opened this issue Jul 7, 2023 · 3 comments
Closed
3 tasks done

IndexError - pop from an empty deque #9487

Iinksafe opened this issue Jul 7, 2023 · 3 comments
Labels
unconfirmed bug A bug report that needs triaging

Comments

@Iinksafe
Copy link

Iinksafe commented Jul 7, 2023

Summary

The library tries to .popleft() from an empty deque when receiving the READY event.

Reproduction Steps

  1. Run the code.
  2. Wait for the on_connect function to be dispatched.
  3. 2/5 of the time errors with the error in the title (and on_ready will NOT run).

Minimal Reproducible Code

Traceback (most recent call last):
  File "main.py", line 279, in <module>
    asyncio.run(start())
  File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/asyncio/base_events.py", line 636, in run_until_complete
    self.run_forever()
  File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/asyncio/base_events.py", line 603, in run_forever
    self._run_once()
  File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/asyncio/base_events.py", line 1884, in _run_once
    handle = self._ready.popleft()
IndexError: pop from an empty deque

Expected Results

image

Actual Results

image

Intents

message_content, guild_messages, dm_messages, presences, members, emojis, guilds

System Information

  • Python v3.10.8-final
  • discord.py v2.3.1-final
  • aiohttp v3.8.3
  • system info: Linux 5.19.0-1027-gcp #.29~22.04.1-Ubuntu SMP Thu Jun 22 05:13:17 UTC 2023

Checklist

  • I have searched the open issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my token from display, if visible.

Additional Context

I upgraded today to Python 3.10. This wasn't happening in Python 3.8. Maybe we should check whether _ready can be .popleft()ed (i.e., check if it's NOT empty before trying to use .popleft()).

@Iinksafe Iinksafe added the unconfirmed bug A bug report that needs triaging label Jul 7, 2023
@Iinksafe
Copy link
Author

Iinksafe commented Jul 7, 2023

Please note that this only happens 2/5 of the time, not always. So there seems to be a problem with receiving events from the gateway (in specific, the READY payload.)

@Rapptz
Copy link
Owner

Rapptz commented Jul 7, 2023

There's nothing in this traceback that points to anything within the library and seems like an asyncio internal issue.

@Iinksafe
Copy link
Author

Iinksafe commented Jul 7, 2023

Alright, thanks for the quick response. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
unconfirmed bug A bug report that needs triaging
Projects
None yet
Development

No branches or pull requests

2 participants