This bug is a bit hard to reproduce in a simple use case since it depends on what the futures you are spawning are doing. Consider this simple example: The first task that completes will swap place with the last task, breaking the ordering of the next poll round.
This https://github.com/DelSkayn/rquickjs/pull/201 fixes the issue by looping over all tasks and then removing them from the list. List doesn't need to be atomic since we always push at the end.
Since futures are being removed using swap, it can mess up the order of how tasks are spawned: https://github.com/DelSkayn/rquickjs/blob/20d3008821c437b9cf94877a1f29e1b9e1c895d6/core/src/runtime/spawner.rs#L80 I also noticed that ordering can also be wrong if we don't sweep for all the completed futures in a poll and remove them.
This bug is a bit hard to reproduce in a simple use case since it depends on what the futures you are spawning are doing. Consider this simple example: The first task that completes will swap place with the last task, breaking the ordering of the next poll round.
This https://github.com/DelSkayn/rquickjs/pull/201 fixes the issue by looping over all tasks and then removing them from the list. List doesn't need to be atomic since we always push at the end.