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

Hotfix: Fix file IO synchronization. #4210

Merged
merged 3 commits into from
Jul 26, 2020
Merged

Hotfix: Fix file IO synchronization. #4210

merged 3 commits into from
Jul 26, 2020

Conversation

ghost
Copy link

@ghost ghost commented Jul 24, 2020

Description:

This fixes File IO synchronization to prevent race conditions for reads/writes, currently towny does something like this:

public void writeFile(File file) {
     synchronized (file) {
          ...
     }
}

This does absolutely nothing because the given file parameter is different whenever another thread uses this method, thus bypassing the locking entirely. This PR fixes this and adds synchronization to other file IO methods.


  • I have tested this pull request for defects on a server.

By making this pull request, I represent that I have the right to waive copyright and related rights to my contribution, and agree that all copyright and related rights in my contributions are waived, and I acknowledge that the TownyAdvanced organization has the copyright to use and modify my contribution under the Towny License for perpetuity.

@ghost ghost requested a review from LlmDl July 24, 2020 17:57
@ghost ghost changed the title Fix file IO synchronization. Hotfix: Fix file IO synchronization. Jul 24, 2020
@ghost ghost self-assigned this Jul 24, 2020
@LlmDl LlmDl merged commit cbaff18 into master Jul 26, 2020
LlmDl added a commit that referenced this pull request Jul 26, 2020
PR #4210.
  - Remove Manual Config Changes and Migrate them automatically instead,
courtesy of Siris with PR #4209.
    - Expect REQUIRED CHANGES in the updating process to become very
infrequent.
@LlmDl LlmDl deleted the hotfix/file-sync branch July 26, 2020 01:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants