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
ConcurrentModificationException with quantum bridges on servers #4336
Comments
I host the server. I will provide more details about that. This crash happens in both singleplayer or multiplayer To Reproduce Step 2. Go to the nether, build a Quantum Ring connected with a Energy Acceptor, put one of the singularity into the chamber. Place a IC2 Chunk Loader to keep these chunks loaded. Connect the IC2 Creative Generator to the Energy Acceptor.
Expected behavior Additional context Environment
Personal thought |
Duplicate of #3800 |
yes i know it's duplicated but #3800 is no longer able to comment anything |
The basic reason is clear, however there is no simple fix for it. (yet?) Postponing is simply no an option as it would not shutdown a network once it losses power. Leading to various other issues. The only real option I am currently seeing is refactoring the energy grid into a more explicit approach for cleaning up. E.g. introducing something like an Or alternatively something about postponing grid rebuilds into the next tick, so it would no longer destroy the network immediately. Just power it down and maybe even have a chance of being charged next tick avoiding the whole rebuild. Which would also require a major change. So as long as I do not see any quick way to fix it without introducing a bunch of new issues or forcing modpacks to abandon inactive AE2 addons due to an API break, it will most likely not be fixed. |
Thanks for the explanation. However, I personally find keeping an unresolved issue closed causes confusion even if it can't be fixed, since this scatters discussion and forces people into making new issues whenever they encounter it. Could you please leave #3800 open so that discussion can take place in a central place? Instead of closing the issue, you may give a tag like "help wanted" or "challenging", and in order to avoid overheated discussions you may edit the first comment to notify people of the rules. |
I made a workaround to this exception. Now the game will not crash in that case. The commit is here. It might be an alternative to refactoring in current stage. |
Sorry for making a duplicate issue. I do realize that this bug has been reported many times, such as #3800 and duplicates such as #4149, #4210, #4287 and many others. However, since most of these issues are either closed or locked and the bug is affecting our server even with the latest version, we have to make a new issue in order to share some of our findings. Since most of the mods, as well as all other parts of Applied Energistics except for this particular bug are working fine, we're very interested in seeking a fix for this and would appreciate that for the benefit of both our server and the community as a whole.
We are using Forge server (no bukkit or sponge). The save works fine in a singleplayer client, but when used on a server it crashes seconds after the server is launched. The stack trace is omitted because it's similar to the other issues linked above.
We patched the mod following the build instructions and printed some stack traces around the place where ConcurrentModificationException occured. This one was particularly interesting: (line numbers in EnergyGridCache.java may be off a bit due to patched code)
It seems like that while AE was drawing energy from the network, one of the energy devices was exhausted and caused its power state to become "Empty", which triggered block updates across the network. The Quantum Bridge then found that it was disconnected (maybe the other chunk was not loaded or not updated yet) and triggered a network recalculation and split into two different networks. The part with the updated Quantum Bridge is removed from the original network and moved into a new network. After all the event processing is done, the code tries to remove the energy device from the list of energy providers, but the iterator is already invalid because of the network recalculation.
By doing a fast
git blame
I found thatNetworkEventBus
have already accounted for the case where the AE network structure is changed while posting the event, and the code was introduced at d7e2ae8 as a fix for #3653. However, the callers ofpostEvent
, such as what happened here, have yet to anticipate for such an edge case.From my own coding experience, I would propose to postpone
postEvent
calls and put them in an event queue to be called later. That is to invoke subscribers async as opposed to sync and write an event loop to handle all events. However, I'm not sure if that would work out here, and insight from the developers is needed.As a player, thank you for writing and maintaining such a powerful mod. As a developer, I understand how hard it is to fight bugs and respond to issues, and I'll not have you feel troubled for that.
The text was updated successfully, but these errors were encountered: