Commit Graph

1 Commits

Author SHA1 Message Date
Aikar
26fb7cc35a
Fix Chunk Post Processing deadlock risk
See: https://gist.github.com/aikar/dd22bbd2a3d78a2fd3d92e95e9f28dc6

as part of post processing a chunk, we can call ChunkConverter.

ChunkConverter then kicks off major physics updates, and when blocks
that have connections across chunk boundries occur, a recursive risk
can occur where A updates a block that triggers a physics request.

That physics request may trigger a chunk request, that then enqueues
a task into the Mailbox ChunkTaskQueueSorter.

If anything requests that same chunk that is in the middle of conversion,
it's mailbox queue is going to be held up, so the subsequent chunk request
will be unable to proceed.

We delay post processing of Chunk.A() 1 "pass" by re stuffing it back into
the executor so that the mailbox ChunkQueue is now considered empty.

This successfully fixed a reoccurring and highly reproduceable crash
for heightmaps.
2020-04-18 04:44:35 -04:00