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 threading issues with ZIP archives #3

Merged
merged 1 commit into from
Dec 30, 2023

Conversation

shartte
Copy link
Contributor

@shartte shartte commented Dec 30, 2023

Turns out that ZipFile#stream() locks the ZipFile while the stream is being iterated upon. Presumably since it expects that the ZipFile could be written to.
Since we use it read-only, we can avoid that, but now have to write our own Spliterator over the Iterator, which doesn't lock the ZipFile.

ZipFile#getInputStream seems to be implemented in a thread-safe manner and reads on the underlying ZipFile are synchronized (which is not ideal, but doesn't crash either).

@shartte shartte merged commit 7c8d016 into neoforged:main Dec 30, 2023
2 checks passed
@shartte shartte deleted the fix-zip-concurrency branch December 30, 2023 14:38
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.

1 participant