DavidQF555 / Beams

A Minecraft mod
GNU General Public License v3.0
2 stars 0 forks source link

[1.18.2-1.11.1] ConcurrentModificationException + server crash when chunk w/ aimed beam is unloaded #16

Closed nicwatson closed 1 year ago

nicwatson commented 1 year ago

When a beam direction has been altered with the pointer (e.g. an omnidirectional projector or mirror). there is a ConcurrentModificationException and server crash when you move away from the area and the chunk gets unloaded. This can be reproduced with no other mods loaded.

MC version: 1.18.2 Beams version: 1.11.1 Forge version: 40.1.85 or 40.2.0

Steps to reproduce:

  1. Start a new world (server or local)
  2. Move outside of the permanently-loaded spawn chunks
  3. Place an omnidirectional projector, or a normal projector aimed at an omnidirectional mirror
  4. Use the pointer to redirect the projector or mirror so that the beam goes off at some angle
  5. Leave the area, traveling far enough that the chunk gets unloaded. (Note: I have not conclusively proven that the crash coincides with the chunk unloading, but I do know it happens when you move some distance away.)

Does not appear to happen if the beams are confined to the spawn chunks; does not appear to happen with just a simple, unidirectional projector and no mirrors. We did not experience this issue when using Beams 1.10.0. (We have not tried 1.10.1 or 1.11.0.)

I have three documents to offer:

https://gist.github.com/nicwatson/3f7530623c222c6d7ebc232fdf9e5a97 - report from crash server thread in single-player with no other mods. The stack trace is quite generic and does not implicate Beams except circumstantially (i.e. because it's the only mod present). But see further down for a log that specifically calls out BeamEntity.onRemovedFromWorld().

https://gist.github.com/nicwatson/cb20bb54a8a36ca6881424429bc6d69d - report from another crash on a different server, which had many other mods active; the stacktrace is essentially the same as the crash report above, but I've included it for reasons explained below.

https://gist.github.com/nicwatson/a5243c9c5a942b2c2253539e438c20c0 - excerpt from the server console log for the second crash report provided above. There is an additional stacktrace here that provides information NOT included in the crash report. This line shows up in that stacktrace: io.github.davidqf555.minecraft.beams.common.entities.BeamEntity.onRemovedFromWorld(BeamEntity.java:198) ~[beams-1.18.2-1.11.1.jar%2348!/:1.18.2-1.11.1]

Hope this helps. My colleagues and I are very excited about this mod.

DavidQF555 commented 1 year ago

I'm currently debugging the issue. It has to do with the fact that I am trying to access the tile entity when a beam entity is removed. The bug is also present in 1.10.0 though.

DavidQF555 commented 1 year ago

Fixed in bc186b9.