magefree / mage

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

AI: Tamiyo, Collector of Tales cause memory leaks #5765

Open CCTV-1 opened 5 years ago

CCTV-1 commented 5 years ago

when both the opponent and me control 'Tamiyo, Collector of Tales',the +1 broken. only test in player vs ai. server log(...\n...\n... is a lot of duplicate rows):

ERROR 2019-04-27 14:43:40,992 Error getting non-land names from DB : org.h2.jdbc.JdbcSQLException: General error: "java.lang.IllegalStateException: Reading from nio:D:/XMAGE/mage-server/db/cards.h2.mv.db failed; file length -1 read length 768 at 79299345 [1.4.197/1]"; SQL statement:
SELECT DISTINCT `name` FROM `card` WHERE (NOT `types` LIKE ? )  [50000-197] =>[pool-1-thread-1] CardRepository.getNonLandNames
...
...
...
ERROR 2019-04-27 14:43:41,008 Error getting non-land names from DB : org.h2.jdbc.JdbcSQLException: General error: "java.lang.IllegalStateException: Reading from nio:D:/XMAGE/mage-server/db/cards.h2.mv.db failed; file length -1 read length 768 at 79299345 [1.4.197/1]"; SQL statement:
SELECT DISTINCT `name` FROM `card` WHERE (NOT `types` LIKE ? )  [50000-197] =>[pool-1-thread-1] CardRepository.getNonLandNames
INFO  2019-04-27 14:43:47,348 GAME END  gameId: 9f165ed8-ffd7-487c-8d47-17e8bbdf792b [computer => L] - [PLAYER => W]       =>[GAME 9f165ed8-ffd7-487c-8d47-17e8bbdf792b] GameImpl.play
ERROR 2019-04-27 14:43:48,174 Error finding card from DB : org.h2.jdbc.JdbcSQLException: General error: "java.lang.IllegalStateException: Reading from nio:D:/XMAGE/mage-server/db/cards.h2.mv.db failed; file length -1 read length 256 at 98918460 [1.4.197/1]"; SQL statement:
SELECT * FROM `card` WHERE ((`setCode` = ? AND `cardNumber` = ? ) AND `nightCard` = ? ) LIMIT 1  [50000-197] =>[CALL main-50] CardRepository.findCard
ERROR 2019-04-27 14:43:48,188 Tried to restart the DB: not successful                                                    =>[CALL main-50] Deck.createCardNotFoundGameException
Exception in thread "CALL main-50" java.lang.RuntimeException: mage.game.GameException: Card not found - Breeding Pool - RNA/246 for deck - null
Possible reason is, that you use cards in your deck, that are only supported in newer versions of the server.
So it can help to use the same card from another set, that's already supported from this server.
        at mage.server.MageServerImpl.lambda$execute$67(MageServerImpl.java:1163)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: mage.game.GameException: Card not found - Breeding Pool - RNA/246 for deck - null
Possible reason is, that you use cards in your deck, that are only supported in newer versions of the server.
So it can help to use the same card from another set, that's already supported from this server.
        at mage.cards.decks.Deck.createCardNotFoundGameException(Deck.java:119)
        at mage.cards.decks.Deck.load(Deck.java:76)
        at mage.server.TableController.updateDeck(TableController.java:445)
        at mage.server.TableManager.updateDeck(TableManager.java:181)
        at mage.server.MageServerImpl.lambda$updateDeck$2(MageServerImpl.java:351)
        at mage.server.MageServerImpl.lambda$execute$67(MageServerImpl.java:1161)
        ... 3 more
ERROR 2019-04-27 14:43:53,178 Error finding card from DB : org.h2.jdbc.JdbcSQLException: General error: "java.lang.IllegalStateException: Reading from nio:D:/XMAGE/mage-server/db/cards.h2.mv.db failed; file length -1 read length 256 at 98918460 [1.4.197/1]"; SQL statement:
SELECT * FROM `card` WHERE ((`setCode` = ? AND `cardNumber` = ? ) AND `nightCard` = ? ) LIMIT 1  [50000-197] =>[CALL main-65] CardRepository.findCard
ERROR 2019-04-27 14:43:53,189 Tried to restart the DB: not successful                                                    =>[CALL main-65] Deck.createCardNotFoundGameException
Exception in thread "CALL main-65" java.lang.RuntimeException: mage.game.GameException: Card not found - Breeding Pool - RNA/246 for deck - null
Possible reason is, that you use cards in your deck, that are only supported in newer versions of the server.
So it can help to use the same card from another set, that's already supported from this server.
        at mage.server.MageServerImpl.lambda$execute$67(MageServerImpl.java:1163)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: mage.game.GameException: Card not found - Breeding Pool - RNA/246 for deck - null
Possible reason is, that you use cards in your deck, that are only supported in newer versions of the server.
So it can help to use the same card from another set, that's already supported from this server.
        at mage.cards.decks.Deck.createCardNotFoundGameException(Deck.java:119)
        at mage.cards.decks.Deck.load(Deck.java:76)
        at mage.server.TableController.updateDeck(TableController.java:445)
        at mage.server.TableManager.updateDeck(TableManager.java:181)
        at mage.server.MageServerImpl.lambda$updateDeck$2(MageServerImpl.java:351)
        at mage.server.MageServerImpl.lambda$execute$67(MageServerImpl.java:1161)
        ... 3 more
ERROR 2019-04-27 14:43:53,270 Error finding card from DB : org.h2.jdbc.JdbcSQLException: General error: "java.lang.IllegalStateException: Reading from nio:D:/XMAGE/mage-server/db/cards.h2.mv.db failed; file length -1 read length 256 at 98918460 [1.4.197/1]"; SQL statement:
SELECT * FROM `card` WHERE ((`setCode` = ? AND `cardNumber` = ? ) AND `nightCard` = ? ) LIMIT 1  [50000-197] =>[WorkerThread#3[192.168.0.112:56213]] CardRepository.findCard
ERROR 2019-04-27 14:43:53,278 Tried to restart the DB: not successful                                                    =>[WorkerThread#3[192.168.0.112:56213]] Deck.createCardNotFoundGameException
FATAL 2019-04-27 14:43:53,279                                                                                            =>[WorkerThread#3[192.168.0.112:56213]] MageServerImpl.handleException
mage.game.GameException: Card not found - Breeding Pool - RNA/246 for deck - null
Possible reason is, that you use cards in your deck, that are only supported in newer versions of the server.
So it can help to use the same card from another set, that's already supported from this server.
        at mage.cards.decks.Deck.createCardNotFoundGameException(Deck.java:119)
        at mage.cards.decks.Deck.load(Deck.java:76)
        at mage.server.TableController.submitDeck(TableController.java:415)
        at mage.server.TableManager.submitDeck(TableManager.java:168)
        at mage.server.MageServerImpl$6.execute(MageServerImpl.java:334)
        at mage.server.MageServerImpl$6.execute(MageServerImpl.java:326)
        at mage.server.MageServerImpl.executeWithResult(MageServerImpl.java:1187)
        at mage.server.MageServerImpl.submitDeck(MageServerImpl.java:326)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.jboss.remoting.transporter.TransporterHandler.invoke(TransporterHandler.java:87)
        at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:967)
        at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:798)
        at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:751)
        at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:586)
        at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:234)

when olny my control Tamiyo, Collector of Tales,+1 work, when ai cast Tamiyo, Collector of Tales,then -3,my control Tamiyo, Collector of Tales +1 broken,but ai control Tamiyo, Collector of Tales +1 still work.

JayDi85 commented 5 years ago

It's a memory problem (xmage server have memory leaks and needs restart after some time of active plays). You can restart server or increase server's memory (-Xmx512m param in launcher - java server option) for more plays without restart.

But you must plays tens/hundreds games without restart to catch that error. Report here if you gets it in first games after restart.

CCTV-1 commented 5 years ago

hmmmm,in test,my server's setting:"-Xms1024m -Xmx1024m" and only play once game.

JayDi85 commented 5 years ago

Try to change Xms1024m to Xms256m

CCTV-1 commented 5 years ago

still appear,but this time ai first of all cast Tamiyo, Collector of Tales then -3 +1 +1 ...,then server output errror(ai control still work,my control still don't work).

JayDi85 commented 5 years ago

Can you upload your and ai decks?

CCTV-1 commented 5 years ago
4 [RNA:246] Breeding Pool
1 [RIX:185] Arch of Orazca
4 [DOM:240] Hinterland Harbor
3 [RNA:257] Simic Guildgate
6 [UST:216] Forest
6 [UST:213] Island
4 [DOM:60] Opt
4 [RNA:178] Growth Spiral
2 [GRN:54] Sinister Sabotage
4 [GRN:32] Chemister's Insight
4 [RNA:149] Wilderness Reclamation
3 [XLN:74] Search for Azcanta
3 [WAR:54] Jace, Wielder of Mysteries
3 [WAR:220] Tamiyo, Collector of Tales
4 [M19:199] Root Snare
1 [GRN:140] Pause for Reflection
2 [GRN:223] Discovery // Dispersal
2 [M19:306] Nexus of Fate
SB: 2 [RNA:122] Biogenic Ooze
SB: 2 [XLN:179] Carnage Tyrant
SB: 3 [XLN:176] Atzocan Archer
SB: 3 [GRN:126] Crushing Canopy
SB: 4 [RIX:44] Negate
SB: 1 [GRN:54] Sinister Sabotage
LAYOUT MAIN:(1,6)(CMC,false,79)|([RNA:246],[RNA:246],[RNA:246],[RNA:246],[RIX:185],[DOM:240],[DOM:240],[DOM:240],[DOM:240],[RNA:257],[RNA:257],[RNA:257],[UST:216],[UST:216],[UST:216],[UST:216],[UST:216],[UST:216],[UST:213],[UST:213],[UST:213],[UST:213],[UST:213],[UST:213])([DOM:60],[DOM:60],[DOM:60],[DOM:60])([RNA:178],[RNA:178],[RNA:178],[RNA:178],[XLN:74],[XLN:74],[XLN:74],[M19:199],[M19:199],[M19:199],[M19:199],[GRN:140])([GRN:54],[GRN:54])([GRN:32],[GRN:32],[GRN:32],[GRN:32],[RNA:149],[RNA:149],[RNA:149],[RNA:149],[WAR:54],[WAR:54],[WAR:54],[WAR:220],[WAR:220],[WAR:220])([GRN:223],[GRN:223],[M19:306],[M19:306])
LAYOUT SIDEBOARD:(1,3)(RARITY,false,100)|([GRN:126],[GRN:126],[GRN:126],[RIX:44],[RIX:44],[RIX:44],[RIX:44])([XLN:176],[XLN:176],[XLN:176],[GRN:54])([RNA:122],[RNA:122],[XLN:179],[XLN:179])

ai and me deck Is the same.

JayDi85 commented 5 years ago

Thanks for report, I can confirm the problem.