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

java.util.ConcurrentModificationException #4661

Closed
Quezler opened this issue Apr 17, 2022 · 8 comments
Closed

java.util.ConcurrentModificationException #4661

Quezler opened this issue Apr 17, 2022 · 8 comments

Comments

@Quezler
Copy link
Contributor

Quezler commented Apr 17, 2022

Modpack Version

1.1.2

Describe your issue.

pneumaticcraft seems to have a tendency to crash some (but not all) players on a server when someone picks up a drone.

waited till the crash happened to myself before reporting (didn't happen since i placed & picked those drones up, which seems to not crash), but in this case one of the players said he picked up a drone item after unplonking it, the linked log shows me and another player crashing at the same time, but the player that picked the drone up & another player did not crash.

TeamPneumatic/pnc-repressurized#990

bad_egg's screenshot

Crash Report

https://gist.github.com/Quezler/d228dc4d5ee7bd088e62af8265a06f0a

Latest Log

No response

Have you modified the modpack?

Yes

User Modifications

kubejs atum:artifacts item tag polyfill

Did the issue happen in singleplayer or on a server?

Server

@Quezler Quezler added the Bug label Apr 17, 2022
@NielsPilgaard NielsPilgaard added Status: Reported The mod issue has been reported. Mod Issue and removed Bug labels Apr 17, 2022
@Quezler
Copy link
Contributor Author

Quezler commented May 2, 2022

after trying some of @desht's debug builds the issue was fixed by adding a config option to disable nbt stripping.

this won't fix it by default, but this comment will be found by e6 people searching on github for the exception message.

(going to the linked issue & reading the commit mentions at the bottom should help those people find the config option)

i waited roughly a week before updating this to make sure the crash didn't occur again, and the fix works perfectly. 👍

@NielsPilgaard NielsPilgaard added Status: Fixed In Next Release Status: Reported The mod issue has been reported. and removed Status: Reported The mod issue has been reported. Status: Fixed In Next Release labels May 2, 2022
@NielsPilgaard
Copy link
Collaborator

NielsPilgaard commented May 2, 2022

What would we lose, if anything, by switching the config to true by default?

@Quezler
Copy link
Contributor Author

Quezler commented May 2, 2022

but potentially increase the amount of network chatter from server to (each) client.

@NielsPilgaard
Copy link
Collaborator

Ah ^^' I'm not sure whether that's worth it or not. Do you have any idea as to how frequently this bug appears?

@Quezler
Copy link
Contributor Author

Quezler commented May 2, 2022

Well, it appears to happen on multiplayer servers when someone is holding a drone, then other players within render distance have a possibility to crash (to the main menu, its not a hard client crash).

I don't see reports that often (old ones or people just don't bother reporting it or no one uses drones), i'd say inform players about the option so they can toggle it themselves if they encounter it, but good luck on telling absolutely everyone.

but assuming there is only extra data if other players are in range + there is no easy fix in sight it might just be more convenient to have it on by default for everyone, at the cost of some more network traffic, but hey this is modded mc.

some results from the enigmatica discord server, mostly older posts & by members that actually use drones:
Screen Shot 2022-05-02 at 18 37 46

edit:

essentially only a problem if players are together when they're playing with drone automation, basing apart of periodically visiting is safe, but i recently also saw the author commit the same fix for armor so perhaps that's borked too 🤔

(not sure if the armor patch is released yet on curseforge)

@NielsPilgaard
Copy link
Collaborator

NielsPilgaard commented May 2, 2022

Alrighty, thanks 👍 Based on that, I think it's best to enable it by default.

@NielsPilgaard NielsPilgaard added Status: Fixed In Next Release and removed Status: Reported The mod issue has been reported. labels May 2, 2022
@desht
Copy link

desht commented May 3, 2022

It's liable to affect any item which uses pressure (so drones, armor, minigun...)

From my investigations, it's almost certainly down to some other mod making alterations to item NBT during the IForgeItem#getShareTag() method, which is used to sync NBT to the client (either to add server-only data that the client needs, or strip server data that the client doesn't).

IForgeItem#getShareTag() can run on both the main and network threads of the server, so it's critical that the itemstack NBT is only read, never modified during the method. The correct approach is to copy the item's NBT and modify & return that local copy. If any mod does modify the item's own NBT in that method, any attempt to read it (like I do) is susceptible to a CME, since NBT storage is not thread-safe.

Problem is trying to determine which mod is misbehaving. I've done a quick overview of everything in E6 but I've found nothing obvious as yet. But I'll keep looking and report back if I do spot something.

@Quezler
Copy link
Contributor Author

Quezler commented May 3, 2022

The only mod that comes to mind that modifies the nbt of items from other mods is astral sorcery, it has a tendency to add an AS_Amulet_Holder tag to any freshly held weapon or equipped armor, it does not seem to apply outside items in the weapons or armor category, but its the only one i could think of 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants