Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix async race condition on new chunks (closes #3020) #3061

Closed
wants to merge 1 commit into from
Closed

Fix async race condition on new chunks (closes #3020) #3061

wants to merge 1 commit into from

Conversation

ezterry
Copy link
Contributor

@ezterry ezterry commented Jul 3, 2016

This patch fixes a race condition that sometimes caused a just generated chunk to be generated a second time. In some this caused generated structures to appear incomplete such as in Issue #3020 when the second generated version effectively overwrote the original version of the chunk.

This patch ensures when ProvideChunk calls LoadChunk synchronously we always attempt to load the chunk (if not cached) thus avoid the race condition without changing the logic for async loading for chunks already saved to disk.

Thus this should retain the async functionality from PR #2946 while preventing generation issues caused by the race condition.

This patch fixes a race condition that sometimes caused a just generated chunk
to be generated a second time.  In some this caused generated structures to
appear incomplete such as in Issue #3020 when the second generated version
effectively overwrote the original version of the chunk.

This patch ensures when ProvideChunk calls LoadChunk synchronously we always
attempt to load the chunk (if not cached) thus avoid the race condition without
changing the logic for async loading for chunks already saved to disk.

Thus this should retain the async functionality from PR #2946 while preventing
generation issues caused by the race condition.
@CLAassistant
Copy link

CLAassistant commented Jul 3, 2016

CLA assistant check
All committers have signed the CLA.

@ezterry
Copy link
Contributor Author

ezterry commented Jul 3, 2016

To help see the actual change, here is a side by side, makes reading/verifying this diff of a diff easier.
diff

@Actuarius
Copy link

@mezz added labels [Bug]

@Actuarius Actuarius added the Bug This request reports or fixes a new or existing bug. label Jul 11, 2016
@ezterry
Copy link
Contributor Author

ezterry commented Jul 14, 2016

rebased to #3090

@ezterry ezterry closed this Jul 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This request reports or fixes a new or existing bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants