I am working on a larger simulator (Mocasin) that uses the simpy discrete event simulation framework. The simulator mostly works correctly, but for some larger problems I get an error like this:
Traceback (most recent call last):
File "~/virtualenvs/mocasin/lib/python3.9/site-packages/simpy/core.py", line 190, in step
self._now, _, _, event = heappop(self._queue)
IndexError: index out of range
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "~/virtualenvs/mocasin/lib/python3.9/site-packages/simpy/core.py", line 254, in run
self.step()
File "~/virtualenvs/mocasin/lib/python3.9/site-packages/simpy/core.py", line 192, in step
raise EmptySchedule()
simpy.core.EmptySchedule
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "~/projects/mocasin/mocasin/mocasin/tasks/__init__.py", line 45, in generate_mapping
generate_mapping(cfg)
File "~/projects/mocasin/mocasin/mocasin/tasks/generate_mapping.py", line 74, in generate_mapping
s.run()
File "~/projects/mocasin/mocasin/mocasin/simulate/__init__.py", line 201, in _run
self.env.run(finished)
File "~/virtualenvs/mocasin/lib/python3.9/site-packages/simpy/core.py", line 260, in run
raise RuntimeError(
RuntimeError: No scheduled events left but "until" event was not triggered: <Process(run) object at 0x7f129039d790>
I am pretty much clueless on what exactly this error message means, but it appears that this is an internal error in simpy. Does anyone have more insights on the conditions that could trigger this error?
I don't know if this error indicates a bug in simpy, or rather in our Mocasin simulator. To investigate this, I tried to find a minimal example that triggers the error, but I haven't been able to find one. It seems that the error is only triggered for very large problems with a huge number of events. This, however, makes it very hard to get to the root cause. Any pointers on how to debug the problem would be very appreciated.