Skip to content

Copy annotation lists during scan data compaction - #708

Merged
embeddedt merged 1 commit into
embeddedt:1.20from
BonsUnleashed:bons-furious/scan-data-copy
Nov 13, 2026
Merged

embeddedt merged 1 commit into
embeddedt:1.20from
BonsUnleashed:bons-furious/scan-data-copy

Conversation

@BonsUnleashed

Copy link
Copy Markdown
Contributor

Copy the ArrayList annotation values when compacting scan data, instead of trimming the originals. The copy keeps the ArrayList type and is already sized to its elements, and the lists that other mods' scan data still point to are never modified.

Compaction runs from ModernFix's constructor, during parallel mod construction, while Forge can be streaming the same lists in AutomaticEventSubscriber.inject to pick each subscriber's sides. ArrayList.trimToSize increments modCount even when nothing is removed, so an overlapping stream throws ConcurrentModificationException and mod loading fails. We hit this exception in that stream once, while loading a large pack.

Both builds are ModernFix 5.27.92+mc1.20.1 from the 1.20 head, on Minecraft 1.20.1. With a small test mod on Forge 47.4.28 that streams its own scan data and waits inside the stream until ModernFix has compacted it, the unchanged build threw in 3 of 3 starts and this change in 0 of 3, with the same elements and subscriber registrations. In Better MC 4's server files on Forge 47.4.20, both builds completed ten fresh starts and a saved world restart with identical subscriber registrations and no new errors; those ordinary starts did not hit the race.

@embeddedt
embeddedt merged commit 41cbbbe into embeddedt:1.20 Nov 13, 2026
1 check passed
@BonsUnleashed

Copy link
Copy Markdown
Contributor Author

Thanks for merging this!

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.

2 participants