mage icon indicating copy to clipboard operation
mage copied to clipboard

ConcurrentModificationError in GlamerSpinnersEffect

Open xenohedron opened this issue 2 months ago • 5 comments

GameImpl.playPriority java.util.ConcurrentModificationException at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:911) at java.util.ArrayList$Itr.next(ArrayList.java:861) at mage.cards.g.GlamerSpinnersEffect.apply(GlamerSpinners.java:115) at mage.abilities.AbilityImpl.resolveMode(AbilityImpl.java:229) at mage.abilities.AbilityImpl.resolve(AbilityImpl.java:213) at mage.abilities.TriggeredAbilityImpl.resolve(TriggeredAbilityImpl.java:273) at mage.game.stack.StackAbility.resolve(StackAbility.java:85) at mage.game.GameImpl.resolve(GameImpl.java:1845) at mage.game.GameImpl.playPriority(GameImpl.java:1766) at mage.game.turn.Step.priority(Step.java:73) at mage.game.turn.Phase.playStep(Phase.java:205) at mage.game.turn.Phase.play(Phase.java:91) at mage.game.turn.Turn.play(Turn.java:132) at mage.game.GameImpl.playTurn(GameImpl.java:1183) at mage.game.GameImpl.play(GameImpl.java:1090) at mage.game.GameImpl.start(GameImpl.java:1066) at mage.server.game.GameWorker.call(GameWorker.java:35) at mage.server.game.GameWorker.call(GameWorker.java:16) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:750)

ETB effect of [[Glamer Spinners]] targeted Puresight Merrow which was enchanted with a Shield of the Oversoul. Only one legal target to attach, an Apothecary Initiate, but error completely broke the game when asking for choice. Rollback didn't even restore the state correctly. Neither player was able to regain priority afterwards.

Following repeated error: java.lang.IllegalStateException: Error in unit tests =>[GAME edf33d43-3d39-4cb5-b3da-012553318b89] GameWorker.call java.lang.IllegalStateException: Error in unit tests at mage.game.GameImpl.playPriority(GameImpl.java:1831) at mage.game.turn.Step.priority(Step.java:73) at mage.game.turn.Phase.playStep(Phase.java:205) at mage.game.turn.Phase.play(Phase.java:91) at mage.game.turn.Turn.play(Turn.java:132) at mage.game.GameImpl.playTurn(GameImpl.java:1183) at mage.game.GameImpl.play(GameImpl.java:1090) at mage.game.GameImpl.start(GameImpl.java:1066) at mage.server.game.GameWorker.call(GameWorker.java:35) at mage.server.game.GameWorker.call(GameWorker.java:16) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:750)

xenohedron avatar Oct 16 '25 03:10 xenohedron

Glamer Spinners - (Gatherer) (Scryfall) (EDHREC)

{4}{W/U} Creature — Faerie Wizard 2/4 Flash Flying When this creature enters, attach all Auras enchanting target permanent to another permanent with the same controller.

github-actions[bot] avatar Oct 16 '25 03:10 github-actions[bot]

Looks like a regression from a02313a0 - @theelk801 please be more careful

xenohedron avatar Oct 16 '25 04:10 xenohedron

Looks like it tries to attach to itself, so ConcurrentModificationException raise:

Image

Possible fix: modify addAttachment code somewhere and ignore on itself (“useless reattach”).

JayDi85 avatar Oct 16 '25 04:10 JayDi85

Or maybe not. Its already has “another” filter, so concurrent error is more deeper (maybe choose/selection code ignore that predicate after targeting refactor?).

Image

JayDi85 avatar Oct 16 '25 05:10 JayDi85

I could catch the error in a simple test, and iterating over a copy of the list fixed it. That's what the old code used before careless refactor.

Feel free to investigate if there's something deeper.

xenohedron avatar Oct 16 '25 05:10 xenohedron