Title: "", line 56: IndexError: pop from empty list
Type: crash Stage:
Components: asyncio Versions: Python 3.8
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: asvetlov, jhshi89, yselivanov
Priority: normal Keywords:

Created on 2021-02-19 06:47 by jhshi89, last changed 2021-02-19 06:47 by jhshi89.

Messages (1)
msg387288 - (view) Author: Jinghao Shi (jhshi89) Date: 2021-02-19 06:47
One of our asyncio based application sporadically crash due to this stack trace:

File ".../lib/python3.8/asyncio/", line 48, in run
  File ".../lib/python3.8/asyncio/", line 595, in run_until_complete
    future = tasks.ensure_future(future, loop=self)
  File ".../lib/python3.8/asyncio/", line 669, in ensure_future
    task = loop.create_task(coro_or_future)
  File ".../lib/python3.8/asyncio/", line 431, in create_task
    task = tasks.Task(coro, loop=self, name=name)
  File ".../lib/python3.8/", line 83, in add
  File ".../lib/python3.8/", line 56, in _commit_removals
IndexError: pop from empty list

We do not have a reliable repro. From reading the source code, it appears we should never try to pop from empty list:

 def _commit_removals(self):
        l = self._pending_removals
        discard =
        while l:
            discard(l.pop()) # <-- HERE
Date User Action Args
2021-02-19 06:47:59jhshi89create