magefree / mage

Magic Another Game Engine
http://xmage.today
MIT License
1.88k stars 768 forks source link

ConcurrentModificationException AND NullPointerException Game Rollbacks #7654

Closed foryayfan closed 3 years ago

foryayfan commented 3 years ago

I was playing a game against AI and encountered 2 different rollbacks. It was during moments with multiple ability triggers going off between Orvar, Showdown of the Skalds and some instances being cast on Goldspan Dragon. Java error messages and game log below. Also attached deck.

Rollback Error #1 Game exception occurred: java.util.ConcurrentModificationException Server version: 1.4.48-V2 (build: 2021-02-27 18:40) java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1361) java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126) java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498) java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485) java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:230) java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:196) java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) java.util.stream.ReferencePipeline.anyMatch(ReferencePipeline.java:449) mage.abilities.AbilitiesImpl.containsKey(AbilitiesImpl.java:275) mage.game.permanent.PermanentImpl.addAbility(PermanentImpl.java:375) mage.abilities.effects.common.continuous.GainAbilityControlledEffect.apply(GainAbilityControlledEffect.java:115) mage.abilities.effects.ContinuousEffectImpl.apply(ContinuousEffectImpl.java:112) mage.abilities.effects.ContinuousEffects.apply(ContinuousEffects.java:1082) mage.game.GameState.applyEffects(GameState.java:602) mage.game.GameImpl.applyEffects(GameImpl.java:1577) mage.abilities.AbilityImpl.activate(AbilityImpl.java:233) mage.abilities.ActivatedAbilityImpl.activate(ActivatedAbilityImpl.java:256) mage.players.PlayerImpl.playAbility(PlayerImpl.java:1339) mage.players.PlayerImpl.activateAbility(PlayerImpl.java:1465) mage.player.ai.ComputerPlayer6.act(ComputerPlayer6.java:186) mage.player.ai.ComputerPlayer7.priorityPlay(ComputerPlayer7.java:65) mage.player.ai.ComputerPlayer7.priority(ComputerPlayer7.java:37) mage.game.GameImpl.playPriority(GameImpl.java:1373) mage.game.turn.Step.priority(Step.java:61) mage.game.turn.Phase.playStep(Phase.java:184) mage.game.turn.Phase.play(Phase.java:89) mage.game.turn.Turn.play(Turn.java:128) mage.game.GameImpl.playTurn(GameImpl.java:911) mage.game.GameImpl.play(GameImpl.java:821) mage.game.GameImpl.start(GameImpl.java:797) mage.server.game.GameWorker.call(GameWorker.java:34) java.util.concurrent.FutureTask.run(FutureTask.java:266) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) java.lang.Thread.run(Thread.java:748)

Rollback Error #2 Game exception occurred: java.lang.NullPointerException Server version: 1.4.48-V2 (build: 2021-02-27 18:40) mage.abilities.AbilitiesImpl.lambda$containsKey$24(AbilitiesImpl.java:275) java.util.stream.MatchOps$1MatchSink.accept(MatchOps.java:90) java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1359) java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126) java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498) java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485) java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:230) java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:196) java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) java.util.stream.ReferencePipeline.anyMatch(ReferencePipeline.java:449) mage.abilities.AbilitiesImpl.containsKey(AbilitiesImpl.java:275) mage.game.permanent.PermanentImpl.addAbility(PermanentImpl.java:375) mage.abilities.effects.common.continuous.GainAbilityControlledEffect.apply(GainAbilityControlledEffect.java:115) mage.abilities.effects.ContinuousEffectImpl.apply(ContinuousEffectImpl.java:112) mage.abilities.effects.ContinuousEffects.apply(ContinuousEffects.java:1082) mage.game.GameState.applyEffects(GameState.java:602) mage.game.GameImpl.applyEffects(GameImpl.java:1577) mage.game.GameImpl.playPriority(GameImpl.java:1378) mage.game.turn.Step.priority(Step.java:61) mage.game.turn.Phase.playStep(Phase.java:184) mage.game.turn.Phase.play(Phase.java:89) mage.game.turn.Turn.play(Turn.java:128) mage.game.GameImpl.playTurn(GameImpl.java:911) mage.game.GameImpl.play(GameImpl.java:821) mage.game.GameImpl.start(GameImpl.java:797) mage.server.game.GameWorker.call(GameWorker.java:34) java.util.concurrent.FutureTask.run(FutureTask.java:266) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) java.lang.Thread.run(Thread.java:748)

Game Log 9:44 PM, T13.DR: js2 draws a card 9:44 PM, T13.M1: js2 - Ability triggers: Showdown of the Skalds [ac4] - II, III - Whenever you cast a spell this turn, put a +1/+1 counter on target creature you control. 9:44 PM, T13.M1: js2 sacrificed Treasure [178] (source: Treasure [178]) 9:44 PM, T13.M1: js2 casts Orvar, the All-Form [685] 9:44 PM, T13.M1: js2 - Ability triggers: Showdown of the Skalds [ac4] - Whenever you cast a spell this turn, put a +1/+1 counter on target creature you control. - targeting Goldspan Dragon [435] 9:44 PM, T13.M1: Showdown of the Skalds [ac4]: js2 puts 1 +1/+1 counters on Goldspan Dragon [435] 9:44 PM, T13.M1: js2 puts Orvar, the All-Form [685] from stack onto the Battlefield 9:45 PM, T13.M1: js2 casts Sea Gate Stormcaller [b13] 9:45 PM, T13.M1: js2 - Ability triggers: Showdown of the Skalds [ac4] - Whenever you cast a spell this turn, put a +1/+1 counter on target creature you control. - targeting Goldspan Dragon [435] 9:45 PM, T13.M1: Showdown of the Skalds [ac4]: js2 puts 1 +1/+1 counters on Goldspan Dragon [435] 9:45 PM, T13.M1: js2 puts Sea Gate Stormcaller [b13] from stack onto the Battlefield 9:45 PM, T13.M1: js2 - Ability triggers: Sea Gate Stormcaller [b13] - When Sea Gate Stormcaller [b13] enters the battlefield, copy the next instant or sorcery spell with converted mana cost 2 or less you cast this turn when you cast it. If Sea Gate Stormcaller [b13] was kicked, copy that spell twice instead. You may choose new targets for the copies. 9:46 PM, T13.M1: js2 casts Defiant Strike [c6e] targeting Goldspan Dragon [435] 9:46 PM, T13.M1: js2 - Ability triggers: Goldspan Dragon [435] - Whenever Goldspan Dragon [435] attacks or becomes the target of a spell, create a Treasure token. 9:46 PM, T13.M1: js2 - Ability triggers: Showdown of the Skalds [ac4] - Whenever you cast a spell this turn, put a +1/+1 counter on target creature you control. - targeting Goldspan Dragon [435] 9:46 PM, T13.M1: js2 - Ability triggers: Orvar, the All-Form [685] - Whenever you cast an instant or sorcery spell, if it targets one or more other permanents you control, create a token that's a copy of one of those permanents. 9:46 PM, T13.M1: js2 creates a Goldspan Dragon [110] token 9:46 PM, T13.M1: Showdown of the Skalds [ac4]: js2 puts 1 +1/+1 counters on Goldspan Dragon [435] 9:46 PM, T13.M1: js2 creates a Treasure [0da] token 9:46 PM, T13.M1: js2 puts Defiant Strike [c6e] from stack into their graveyard 9:46 PM, T13.M1: js2 draws a card 9:46 PM, T13.M1: js2 casts Spikefield Hazard [6da] as mdf side of Spikefield Hazard [6da] targeting Goldspan Dragon [435] 9:46 PM, T13.M1: js2 - Ability triggers: Goldspan Dragon [435] - Whenever Goldspan Dragon [435] attacks or becomes the target of a spell, create a Treasure token. 9:46 PM, T13.M1: js2 - Ability triggers: Showdown of the Skalds [ac4] - Whenever you cast a spell this turn, put a +1/+1 counter on target creature you control. - targeting Goldspan Dragon [110] 9:47 PM, T13.M1: js2 - Ability triggers: Sea Gate Stormcaller [b13] - When you cast your next instant or sorcery spell this turn with converted mana cost 2 or less, copy that spell. You may choose new targets for the copy. 9:47 PM, T13.M1: js2 - Ability triggers: Orvar, the All-Form [685] - Whenever you cast an instant or sorcery spell, if it targets one or more other permanents you control, create a token that's a copy of one of those permanents. 9:47 PM, T13.M1: js2 creates a Goldspan Dragon [998] token 9:47 PM, T13.M1: js2 copies Spikefield Hazard [6da] as mdf side of Spikefield Hazard [6da] targeting Goldspan Dragon [435] 9:47 PM, T13.M1: js2 - Ability triggers: Goldspan Dragon [435] - Whenever Goldspan Dragon [435] attacks or becomes the target of a spell, create a Treasure token. 9:47 PM, T13.M1: js2 creates a Treasure [d29] token 9:47 PM, T13.M1: Spikefield Hazard [6da] deals 1 damage to Goldspan Dragon [435] 9:47 PM, T13.M1: Showdown of the Skalds [ac4]: js2 puts 1 +1/+1 counters on Goldspan Dragon [110] 9:47 PM, T13.M1: js2 creates a Treasure [587] token 9:47 PM, T13.M1: Spikefield Hazard [6da] deals 1 damage to Goldspan Dragon [435] 9:47 PM, T13.M1: js2 puts Spikefield Hazard [6da] from stack into their graveyard 9:48 PM, T13.M1: js2 sacrificed Treasure [587] (source: Treasure [587]) 9:48 PM, T13.M1: js2 casts Chilling Trap [f74] targeting Goldspan Dragon [435] 9:48 PM, T13.M1: js2 - Ability triggers: Goldspan Dragon [435] - Whenever Goldspan Dragon [435] attacks or becomes the target of a spell, create a Treasure token. 9:48 PM, T13.M1: js2 - Ability triggers: Showdown of the Skalds [ac4] - Whenever you cast a spell this turn, put a +1/+1 counter on target creature you control. - targeting Goldspan Dragon [998] 9:48 PM, T13.M1: js2 - Ability triggers: Orvar, the All-Form [685] - Whenever you cast an instant or sorcery spell, if it targets one or more other permanents you control, create a token that's a copy of one of those permanents. 9:48 PM, T13.M1: js2 creates a Goldspan Dragon [83c] token 9:48 PM, T13.M1: Showdown of the Skalds [ac4]: js2 puts 1 +1/+1 counters on Goldspan Dragon [998] 9:49 PM, T13.BC: js2 - Ability triggers: Showdown of the Skalds [ac4] - II, III - Whenever you cast a spell this turn, put a +1/+1 counter on target creature you control.

bo1-[W][U][R]-jeskai orvar copycat - Copy.txt

ldeluigi commented 3 years ago

Same when I used [[Golos]] ability for the third time that turn

Game exception occurred: java.util.ConcurrentModificationException
Server version: 1.4.48-V3-beta6 (build: 2021-05-05 14:04)
java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1361)
java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:499)
java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:486)
java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:230)
java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:196)
java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
java.util.stream.ReferencePipeline.anyMatch(ReferencePipeline.java:449)
mage.abilities.AbilitiesImpl.containsKey(AbilitiesImpl.java:264)
mage.game.permanent.PermanentImpl.addAbility(PermanentImpl.java:375)
mage.abilities.effects.common.continuous.GainAbilityControlledEffect.apply(GainAbilityControlledEffect.java:115)
mage.abilities.effects.ContinuousEffectImpl.apply(ContinuousEffectImpl.java:112)
mage.abilities.effects.ContinuousEffects.apply(ContinuousEffects.java:1088)
mage.game.GameState.applyEffects(GameState.java:602)
mage.game.GameImpl.applyEffects(GameImpl.java:1578)
mage.game.GameImpl.playPriority(GameImpl.java:1379)
mage.game.turn.Step.priority(Step.java:61)
mage.game.turn.Phase.playStep(Phase.java:184)
mage.game.turn.Phase.play(Phase.java:89)
mage.game.turn.Turn.play(Turn.java:128)
mage.game.GameImpl.playTurn(GameImpl.java:912)
mage.game.GameImpl.play(GameImpl.java:822)
mage.game.GameImpl.start(GameImpl.java:798)
mage.server.game.GameWorker.call(GameWorker.java:34)
java.util.concurrent.FutureTask.run(FutureTask.java:266)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.lang.Thread.run(Thread.java:748)

Note that the first two activations went smoothly, it crashed at the third one while [[Perplexing Chimera]] was on my battlefield (I casted it between the second and the third activation of golos)

github-actions[bot] commented 3 years ago

Golos, Tireless Pilgrim - (Gatherer) (Scryfall) (EDHREC)

{5} Legendary Artifact Creature — Scout 3/5 When Golos, Tireless Pilgrim enters the battlefield, you may search your library for a land card, put that card onto the battlefield tapped, then shuffle. {2}{W}{U}{B}{R}{G}: Exile the top three cards of your library. You may play them this turn without paying their mana costs.

Perplexing Chimera - (Gatherer) (Scryfall) (EDHREC)

{4}{U} Enchantment Creature — Chimera 3/3 Whenever an opponent casts a spell, you may exchange control of Perplexing Chimera and that spell. If you do, you may choose new targets for the spell. (If the spell becomes a permanent, you control that permanent.)

ldeluigi commented 3 years ago

Game Log:

0.26, T23.M1: Deloo casts Sol Ring [cc4]
0.26, T23.M1: Computer 4 - Ability triggers: Rhystic Study [dd6] - Whenever an opponent casts spell, you may draw a card unless that player pays  .
0.26, T23.M1: Deloo creates a Treasure [eac] token
0.26, T23.M1: Deloo puts Sol Ring [cc4] from stack onto the Battlefield
0.26, T23.M1: Deloo casts Cultivate [318]
0.26, T23.M1: Computer 4 - Ability triggers: Rhystic Study [dd6] - Whenever an opponent casts spell, you may draw a card unless that player pays  .
0.30, T23.M1: Deloo creates a Treasure [f2d] token
0.30, T23.M1: Deloo searches their library (source: Cultivate [318])
0.31, T23.M1: Deloo reveals Forest, Island
0.31, T23.M1: Deloo puts Forest [dd8] from library onto the Battlefield (source: Cultivate [318])
0.31, T23.M1: Deloo puts a card from library into their hand
0.31, T23.M1: Deloo's library is shuffled (source: Cultivate [318])
0.31, T23.M1: Deloo puts Cultivate [318] from stack into their graveyard
0.31, T23.M1: Deloo sacrificed Treasure [f2d] (source: Treasure [f2d])
0.31, T23.M1: Deloo sacrificed Treasure [eac] (source: Treasure [eac])
0.31, T23.M1: Deloo sacrificed Treasure [abc] (source: Treasure [abc])
0.31, T23.M1: Deloo sacrificed Treasure [0ea] (source: Treasure [0ea])
0.31, T23.M1: Deloo activates: Exile the top three cards of your library. You may play them this turn without paying their mana costs. from Golos, Tireless Pilgrim [a25]
0.32, T23.M1: Deloo moves Mana Confluence [ee3] from library to the exile zone (source: Golos, Tireless Pilgrim [a25])
0.32, T23.M1: Deloo moves Commander's Sphere [3c6] from library to the exile zone (source: Golos, Tireless Pilgrim [a25])
0.32, T23.M1: Deloo moves Exotic Orchard [1f2] from library to the exile zone (source: Golos, Tireless Pilgrim [a25])
0.32, T23.M1: Deloo casts Commander's Sphere [3c6]
0.32, T23.M1: Computer 4 - Ability triggers: Rhystic Study [dd6] - Whenever an opponent casts spell, you may draw a card unless that player pays  .
0.32, T23.M1: Deloo creates a Treasure [79b] token
0.33, T23.M1: Deloo puts Commander's Sphere [3c6] from stack onto the Battlefield
0.33, T23.M1: Deloo puts Exotic Orchard [1f2] from exile zone onto the Battlefield
0.33, T23.M1: Deloo plays Exotic Orchard [1f2]
0.34, T23.M1: Deloo sacrificed Treasure [79b] (source: Treasure [79b])
0.34, T23.M1: Deloo sacrificed Treasure [908] (source: Treasure [908])
0.34, T23.M1: Deloo sacrificed Treasure [745] (source: Treasure [745])
0.34, T23.M1: Deloo sacrificed Treasure [33d] (source: Treasure [33d])
0.34, T23.M1: Deloo sacrificed Treasure [a18] (source: Treasure [a18])
0.34, T23.M1: Deloo activates: Exile the top three cards of your library. You may play them this turn without paying their mana costs. from Golos, Tireless Pilgrim [a25]
0.34, T23.M1: Computer 2 sacrificed Commander's Sphere [ee1] (source: Commander's Sphere [ee1])
0.34, T23.M1: Computer 2 activates: draw a card. from Commander's Sphere [ee1]
0.35, T23.M1: Deloo creates a Treasure [dd3] token
0.35, T23.M1: Deloo moves Replicating Ring [360] from library to the exile zone (source: Golos, Tireless Pilgrim [a25])
0.35, T23.M1: Deloo moves Scrambleverse [a04] from library to the exile zone (source: Golos, Tireless Pilgrim [a25])
0.35, T23.M1: Deloo moves Sphere of Safety [769] from library to the exile zone (source: Golos, Tireless Pilgrim [a25])
0.36, T23.M1: Deloo casts Sphere of Safety [769]
0.36, T23.M1: Computer 4 - Ability triggers: Rhystic Study [dd6] - Whenever an opponent casts spell, you may draw a card unless that player pays  .
0.36, T23.M1: Deloo creates a Treasure [dcb] token
0.37, T23.M1: Deloo puts Sphere of Safety [769] from stack onto the Battlefield
0.38, T23.M1: Deloo casts Replicating Ring [360]
0.38, T23.M1: Computer 4 - Ability triggers: Rhystic Study [dd6] - Whenever an opponent casts spell, you may draw a card unless that player pays  .
0.39, T23.M1: Deloo creates a Treasure [3bc] token
0.39, T23.M1: Deloo puts Replicating Ring [360] from stack onto the Battlefield
0.41, T23.M1: Deloo sacrificed Treasure [3bc] (source: Treasure [3bc])
0.41, T23.M1: Deloo sacrificed Treasure [dcb] (source: Treasure [dcb])
0.41, T23.M1: Deloo sacrificed Treasure [dd3] (source: Treasure [dd3])
0.41, T23.M1: Deloo sacrificed Treasure [d36] (source: Treasure [d36])
0.41, T23.M1: Deloo sacrificed Treasure [741] (source: Treasure [741])
0.41, T23.M1: Deloo sacrificed Treasure [b57] (source: Treasure [b57])
0.41, T23.M1: Deloo activates: Exile the top three cards of your library. You may play them this turn without paying their mana costs. from Golos, Tireless Pilgrim [a25]
0.43, T23.M1: Deloo moves Perplexing Chimera [9e0] from library to the exile zone (source: Golos, Tireless Pilgrim [a25])
0.43, T23.M1: Deloo moves Mana Crypt [491] from library to the exile zone (source: Golos, Tireless Pilgrim [a25])
0.43, T23.M1: Deloo moves Farseek [a5c] from library to the exile zone (source: Golos, Tireless Pilgrim [a25])
0.43, T23.M1: Deloo casts Farseek [a5c]
0.43, T23.M1: Computer 4 - Ability triggers: Rhystic Study [dd6] - Whenever an opponent casts spell, you may draw a card unless that player pays  .
0.43, T23.M1: Deloo creates a Treasure [694] token
0.44, T23.M1: Deloo searches their library (source: Farseek [a5c])
0.45, T23.M1: Deloo puts Stomping Ground [e95] from library onto the Battlefield (source: Farseek [a5c])
0.45, T23.M1: Deloo's library is shuffled (source: Farseek [a5c])
0.45, T23.M1: Deloo puts Farseek [a5c] from stack into their graveyard
0.45, T23.M1: Deloo casts Mana Crypt [491]
0.45, T23.M1: Computer 4 - Ability triggers: Rhystic Study [dd6] - Whenever an opponent casts spell, you may draw a card unless that player pays  .
0.45, T23.M1: Deloo creates a Treasure [90c] token
0.45, T23.M1: Deloo puts Mana Crypt [491] from stack onto the Battlefield
0.46, T23.M1: Deloo casts Perplexing Chimera [9e0]
0.46, T23.M1: Computer 4 - Ability triggers: Rhystic Study [dd6] - Whenever an opponent casts spell, you may draw a card unless that player pays  .
0.46, T23.M1: Deloo creates a Treasure [35e] token
0.47, T23.M1: Deloo puts Perplexing Chimera [9e0] from stack onto the Battlefield
0.47, T23.M1: Deloo sacrificed Treasure [35e] (source: Treasure [35e])
0.47, T23.M1: Deloo sacrificed Treasure [694] (source: Treasure [694])
0.47, T23.M1: Deloo sacrificed Treasure [90c] (source: Treasure [90c])
0.47, T23.M1: Deloo sacrificed Treasure [17c] (source: Treasure [17c])
0.47, T23.M1: Deloo sacrificed Treasure [a1c] (source: Treasure [a1c])
0.47, T23.M1: Deloo activates: Exile the top three cards of your library. You may play them this turn without paying their mana costs. from Golos, Tireless Pilgrim [a25]