Create icon indicating copy to clipboard operation
Create copied to clipboard

Fix concurrency issue in Creative Tabs System

Open IThundxr opened this issue 1 year ago • 10 comments

Fixes #6222

Forge's parallel/concurrent mod loading causes multiple mods to insert into this hashmap at the same time, switching to a concurrent hashmap will make this thread safe.

IThundxr avatar Apr 29 '24 19:04 IThundxr

4f4b21c0a5d67379214e78f72781dfbc3e2696b4 should probably be reverted. As I mentioned here, using HashMap over IdentityHashMap places most of Create's blocks in the palette tab for some reason, and the same is true with ConcurrentHashMap: 2024-05-01_14 27 54 2024-05-01_14 28 01 While with Collections.synchronizedMap(IdentityHashMap) the tabs remain as they are: 2024-05-01_14 40 42 2024-05-01_14 40 45

VoidLeech avatar May 01 '24 12:05 VoidLeech

4f4b21c should probably be reverted. As I mentioned here, using HashMap over IdentityHashMap places most of Create's blocks in the palette tab for some reason, and the same is true with ConcurrentHashMap: 2024-05-01_14 27 54 2024-05-01_14 28 01 While with Collections.synchronizedMap(IdentityHashMap) the tabs remain as they are: 2024-05-01_14 40 42 2024-05-01_14 40 45

using a synchronizedMap means that all other threads trying to add to the map will be sent into a queue to add into it iirc, this will likely increase loading times by a noticeable amount if many mods are using CreateRegistrate. A solution to this would be extending CHM and basically implementing a IHM ontop of that so you'd have a CIHM, i'll have to take a look at doing this when i've got a bit more time, for now i'll turn this into a draft.

IThundxr avatar May 01 '24 13:05 IThundxr

it'll be fine it appears, oracles docs say that a sync map will just queue inserts which should be fine

IThundxr avatar May 01 '24 13:05 IThundxr

So what I understand this is create issue, not the addons?

Maciek103 avatar May 01 '24 14:05 Maciek103

So what I understand this is create issue, not the addons?

The issue lies in create but only occurs when multiple addons using CreateRegistrate are installed and when forge's parallel mod loading loads create or multiple addon(s) at the same time

IThundxr avatar May 01 '24 14:05 IThundxr

Are we getting Create 0.5.1 patch G now? :]

VladisCrafter avatar May 02 '24 10:05 VladisCrafter

Are we getting Create 0.5.1 patch G now? :]

Probably. @IThundxr could you please also throw in a fix for #6421 before you release the update? Not sure if you've seen the issue yet.

Chris6ix avatar May 03 '24 10:05 Chris6ix

i forked the project and built from the branch, still noticed no changes from the regular jar on curseforge. The bug only happens when you log directly from a server and gets fixed if u go on SP first. this is truly annoying and a hotfix would be the best thing to do as this is a BIG issue

Leclowndu93150 avatar May 15 '24 18:05 Leclowndu93150

i forked the project and built from the branch, still noticed no changes from the regular jar on curseforge. The bug only happens when you log directly from a server and gets fixed if u go on SP first. this is truly annoying and a hotfix would be the best thing to do as this is a BIG issue

the issue happens with parallel mod loading, joining a single player world or not changes nothing.

IThundxr avatar May 15 '24 18:05 IThundxr

it somehow fixes it for me ???

Leclowndu93150 avatar May 15 '24 18:05 Leclowndu93150

Hey @IThundxr could you please push an update with this patch or maybe release a dev build that includes it? This issue is really frustrating and having be gone would be nice :)

Chris6ix avatar Jun 22 '24 17:06 Chris6ix

Hey @IThundxr could you please push an update with this patch or maybe release a dev build that includes it? This issue is really frustrating and having be gone would be nice :)

He released a fix for 1.20 in the form of a jar file, update with the fix will be... at some point. link below. https://nextcloud.ithundxr.dev/s/KAjGmnpj7bczoyr

MFNmodding avatar Jun 23 '24 06:06 MFNmodding

He released a fix for 1.20 in the form of a jar file, update with the fix will be... at some point. link below. https://nextcloud.ithundxr.dev/s/KAjGmnpj7bczoyr

Ah, thank you very much, didn't know he released smth :)

Chris6ix avatar Jun 23 '24 11:06 Chris6ix

Thanks for the PR! Sorry for the wait

simibubi avatar Jul 17 '24 09:07 simibubi