Skip to content

winio: simplify logic remove optimization step.

Tamar Christina requested to merge Phyx/ghc:winio-fix-race-condition into master

Hi All,

This fixes a race condition in winio that happens due to an optimization step. Before this change when we noticed that an I/O request is almost done we would issue a busy wait to wait for the request to finish so we can handle it faster.

The problem here is that the Windows I/O manager will still issue the completion packet. This completion packet may contain a pointer that has already been freed. Or even worse if another request was started, it may get the same pointer as the one of the completed packaged (because free doesn't immediately return memory to the OS and so calloc can return the same pointer again, and does).

These is no way to invalidate the other request safely so this removes the optimization step and sends all requests down the main completion path.

Ok for master and GHC 9?

Merge request reports