magefree / magefree/mage

AI: usage of Terastodon can crash the app (OutOfMemory error)

Open
#11,870 9 comments 0 reactions 0 assignees View on GitHub
AI bug
Dominant language
Java
Stars
2.4k
Forks
940
Avg merge
2d 12h
Merged PRs (30d)
160

Description

Seems a little unclear but whenever im testing a deck against 3 (level 2) bots and i play a terastodon, I get an exception:

FATAL 2024-02-27 22:12:46,146 GameWorker system error [0f90bfa0-6301-4360-b5bf-3d8686548092 - Commander Free For All; T27.M1; active: Jayzz911; stack: 1 (top: Cast Terastodon)]: java.lang.OutOfMemoryError: GC overhead limit exceeded =>[GAME 0f90bfa0-6301-4360-b5bf-3d8686548092] GameWorker.call
java.lang.OutOfMemoryError: GC overhead limit exceeded
at java.util.HashMap.newNode(HashMap.java:1750)
at java.util.HashMap.putVal(HashMap.java:631)
at java.util.HashMap.put(HashMap.java:612)
at java.util.HashSet.add(HashSet.java:220)
at java.util.AbstractCollection.addAll(AbstractCollection.java:344)
at mage.abilities.mana.ActivatedManaAbilityImpl.getProducableManaTypes(ActivatedManaAbilityImpl.java:115)
at mage.MageObjectImpl.getFrameColor(MageObjectImpl.java:229)
at mage.game.permanent.PermanentCard.copyFromCard(PermanentCard.java:122)
at mage.game.permanent.PermanentCard.reset(PermanentCard.java:97)
at mage.game.permanent.Battlefield.reset(Battlefield.java:37)
at mage.game.GameState.applyEffects(GameState.java:670)
at mage.game.GameImpl.applyEffects(GameImpl.java:1880)
at mage.game.GameImpl.playPriority(GameImpl.java:1655)
at mage.game.turn.Step.priority(Step.java:67)
at mage.game.turn.Phase.playStep(Phase.java:204)
at mage.game.turn.Phase.play(Phase.java:90)
at mage.game.turn.Turn.play(Turn.java:137)
at mage.game.GameImpl.playTurn(GameImpl.java:1117)
at mage.game.GameImpl.play(GameImpl.java:1024)
at mage.game.GameImpl.start(GameImpl.java:1000)
at mage.server.game.GameWorker.call(GameWorker.java:34)
at mage.server.game.GameWorker.call(GameWorker.java:15)
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:748)

Let me know if you need any additional info.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the failure by testing a deck against three level-2 bots and playing Terastodon. Start with ActivatedManaAbilityImpl.getProducableManaTypes, then follow the stack through MageObjectImpl, PermanentCard, Battlefield, and GameState.applyEffects. Done means the scenario completes without the reported OutOfMemoryError.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.