magefree / mage

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

Tournament game between AI hangs #9388

Open Alex-Vasile opened 2 years ago

Alex-Vasile commented 2 years ago

Played a NEO draft, me and 7 AI. One of the AI v. AI games hung and never finished, nor was I able to watch it. CPU usage for one core is stuck at 100%. The following was in mageserver.log

WARN  2022-08-20 08:19:40,154 Ability without sourceId:If it would be dealt damage or destroyed, remove a shield counter from it instead. =>[pool-1-thread-1] ContinuousEffects.getControllerOfSourceId 
WARN  2022-08-20 08:19:40,571 Ability without sourceId:If it would be dealt damage or destroyed, remove a shield counter from it instead. =>[pool-1-thread-1] ContinuousEffects.getControllerOfSourceId 
WARN  2022-08-20 08:19:40,606 Ability without sourceId:If it would be dealt damage or destroyed, remove a shield counter from it instead. =>[GAME 54de371a-3da5-4155-abef-12ea1a569498] ContinuousEffects.getControllerOfSourceId 
ERROR 2022-08-20 08:19:52,260 Exception in rules generation for card: Boseiju Reaches Skyward                            =>[WorkerThread#1[192.168.193.75:63225]] CardUtil.getCardRulesWithAdditionalInfo 
java.util.ConcurrentModificationException
    at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:909)
    at java.util.ArrayList$Itr.next(ArrayList.java:859)
    at mage.abilities.AbilitiesImpl.getRules(AbilitiesImpl.java:51)
    at mage.abilities.AbilitiesImpl.getRules(AbilitiesImpl.java:44)
    at mage.util.CardUtil.getCardRulesWithAdditionalInfo(CardUtil.java:1117)
    at mage.util.CardUtil.getCardRulesWithAdditionalInfo(CardUtil.java:1105)
    at mage.cards.CardImpl.getRules(CardImpl.java:217)
    at mage.game.permanent.PermanentImpl.getRules(PermanentImpl.java:261)
    at mage.view.CardView.<init>(CardView.java:394)
    at mage.view.CardView.<init>(CardView.java:245)
    at mage.view.PermanentView.<init>(PermanentView.java:39)
    at mage.view.PlayerView.<init>(PlayerView.java:102)
    at mage.view.GameView.<init>(GameView.java:72)
    at mage.server.game.GameSessionWatcher.getGameView(GameSessionWatcher.java:100)
    at mage.server.game.GameSessionWatcher.init(GameSessionWatcher.java:45)
    at mage.server.game.GameController.lambda$watch$3(GameController.java:453)
    at java.util.Optional.ifPresent(Optional.java:159)
    at mage.server.game.GameController.watch(GameController.java:444)
    at mage.server.game.GameManagerImpl.watchGame(GameManagerImpl.java:135)
    at mage.server.MageServerImpl$9.lambda$execute$0(MageServerImpl.java:847)
    at java.util.Optional.map(Optional.java:215)
    at mage.server.MageServerImpl$9.execute(MageServerImpl.java:845)
    at mage.server.MageServerImpl$9.execute(MageServerImpl.java:841)
    at mage.server.MageServerImpl.executeWithResult(MageServerImpl.java:1181)
    at mage.server.MageServerImpl.watchGame(MageServerImpl.java:841)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    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)
INFO  2022-08-20 08:19:53,936 GAME started a78e1a6a-3cf2-49e0-9508-c9151cb4d873 [] null - Computer 3 - Computer 2        =>[GAME 54de371a-3da5-4155-abef-12ea1a569498] TableController.startGame 
INFO  2022-08-20 08:19:55,238 GAME started 52617b53-b5f4-4787-83b8-0cd086f527de [] null - Computer 8 - Computer 5        =>[GAME 70480a63-7bd6-472f-8e83-114ebc9e7a98] TableController.startGame 
INFO  2022-08-20 08:20:02,038 GAME started d286cef5-e187-4f85-844d-3dbabba1d4bf [] null - Computer 8 - Computer 5        =>[GAME 52617b53-b5f4-4787-83b8-0cd086f527de] TableController.startGame 
INFO  2022-08-20 08:20:02,369 GAME started 6d274da5-c274-4f68-bb82-70363c94b61c [] null - Computer 6 - Computer 4        =>[GAME fd44a522-71e9-40c2-9f47-b9d6ab415741] TableController.startGame 
INFO  2022-08-20 08:24:20,868 GAME started cfdbecb2-b706-4384-9f9f-421e9e7b146b [] Alex - Computer 7                     =>[GAME 62ffc7f0-609f-49ca-9dcb-96e390cc4881] TableController.startGame 
INFO  2022-08-20 08:27:27,970 Tourn. match started id:0afe1d9c-e862-4e5f-8be8-baa9d4f5c720 tournId: 3897ef1b-97a0-4539-9502-f6e38673e139 =>[CALL main-48] TableController.startMatch 
INFO  2022-08-20 08:27:27,988 GAME started f0ac8185-48b1-4555-8499-a382c36963e2 [] null - Computer 3 - Computer 8        =>[CALL main-48] TableController.startGame 
INFO  2022-08-20 08:27:27,994 Tourn. match started id:7226997d-3601-4858-87a3-79375b84285c tournId: 3897ef1b-97a0-4539-9502-f6e38673e139 =>[CALL main-48] TableController.startMatch 
INFO  2022-08-20 08:27:28,002 GAME started 0d7aec1d-dcd2-4dbd-8761-7f06d3dad654 [] Alex - Computer 4                     =>[CALL main-48] TableController.startGame 
INFO  2022-08-20 08:27:28,004 Tourn. match started id:45bcd1e2-c0db-4752-8952-5357a68ac6a1 tournId: 3897ef1b-97a0-4539-9502-f6e38673e139 =>[CALL main-48] TableController.startMatch 
INFO  2022-08-20 08:27:28,010 GAME started af18ae20-e017-4d31-b0bb-0fb3d678fc08 [] null - Computer 2 - Computer 5        =>[CALL main-48] TableController.startGame 
INFO  2022-08-20 08:27:28,028 Tourn. match started id:bf1038e5-8982-47ed-8aaa-c7edab41a5a0 tournId: 3897ef1b-97a0-4539-9502-f6e38673e139 =>[CALL main-48] TableController.startMatch 
INFO  2022-08-20 08:27:28,032 GAME started 6b0d8fd4-0d27-4f0b-9ced-88c8d01d59a8 [] null - Computer 7 - Computer 6        =>[CALL main-48] TableController.startGame 
INFO  2022-08-20 08:27:35,058 GAME started 66eaa36e-615b-4c6a-814b-c006b12fde71 [] null - Computer 2 - Computer 5        =>[GAME af18ae20-e017-4d31-b0bb-0fb3d678fc08] TableController.startGame 
INFO  2022-08-20 08:27:35,497 GAME started f83bc293-c2e2-4adf-975d-34a0bf71c91d [] null - Computer 8 - Computer 3        =>[GAME f0ac8185-48b1-4555-8499-a382c36963e2] TableController.startGame 
INFO  2022-08-20 08:27:37,166 GAME started 2913e763-e5f4-405f-9c2e-ca3182cbf1aa [] null - Computer 6 - Computer 7        =>[GAME 6b0d8fd4-0d27-4f0b-9ced-88c8d01d59a8] TableController.startGame 
INFO  2022-08-20 08:27:38,977 GAME started de26ac68-e1af-4436-b867-25967de4fefb [] null - Computer 2 - Computer 5        =>[GAME 66eaa36e-615b-4c6a-814b-c006b12fde71] TableController.startGame 
ERROR 2022-08-20 08:33:34,704 Exception in rules generation for card: Bronze Cudgels                                     =>[WorkerThread#3[192.168.193.75:63226]] CardUtil.getCardRulesWithAdditionalInfo 
java.util.ConcurrentModificationException
    at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:909)
    at java.util.ArrayList$Itr.next(ArrayList.java:859)
    at mage.abilities.AbilitiesImpl.getRules(AbilitiesImpl.java:51)
    at mage.abilities.AbilitiesImpl.getRules(AbilitiesImpl.java:44)
    at mage.util.CardUtil.getCardRulesWithAdditionalInfo(CardUtil.java:1117)
    at mage.util.CardUtil.getCardRulesWithAdditionalInfo(CardUtil.java:1105)
    at mage.cards.CardImpl.getRules(CardImpl.java:217)
    at mage.game.permanent.PermanentImpl.getRules(PermanentImpl.java:261)
    at mage.view.CardView.<init>(CardView.java:394)
    at mage.view.CardView.<init>(CardView.java:245)
    at mage.view.PermanentView.<init>(PermanentView.java:39)
    at mage.view.PlayerView.<init>(PlayerView.java:102)
    at mage.view.GameView.<init>(GameView.java:72)
    at mage.server.game.GameSessionWatcher.getGameView(GameSessionWatcher.java:100)
    at mage.server.game.GameSessionWatcher.init(GameSessionWatcher.java:45)
    at mage.server.game.GameController.lambda$watch$3(GameController.java:453)
    at java.util.Optional.ifPresent(Optional.java:159)
    at mage.server.game.GameController.watch(GameController.java:444)
    at mage.server.game.GameManagerImpl.watchGame(GameManagerImpl.java:135)
    at mage.server.MageServerImpl$9.lambda$execute$0(MageServerImpl.java:847)
    at java.util.Optional.map(Optional.java:215)
    at mage.server.MageServerImpl$9.execute(MageServerImpl.java:845)
    at mage.server.MageServerImpl$9.execute(MageServerImpl.java:841)
    at mage.server.MageServerImpl.executeWithResult(MageServerImpl.java:1181)
    at mage.server.MageServerImpl.watchGame(MageServerImpl.java:841)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    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)
ERROR 2022-08-20 08:33:34,712 Exception in rules generation for card: Nezumi Prowler                                     =>[WorkerThread#3[192.168.193.75:63226]] CardUtil.getCardRulesWithAdditionalInfo 
java.util.ConcurrentModificationException
    at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:909)
    at java.util.ArrayList$Itr.next(ArrayList.java:859)
    at mage.abilities.AbilitiesImpl.getRules(AbilitiesImpl.java:51)
    at mage.abilities.AbilitiesImpl.getRules(AbilitiesImpl.java:44)
    at mage.util.CardUtil.getCardRulesWithAdditionalInfo(CardUtil.java:1117)
    at mage.util.CardUtil.getCardRulesWithAdditionalInfo(CardUtil.java:1105)
    at mage.cards.CardImpl.getRules(CardImpl.java:217)
    at mage.game.permanent.PermanentImpl.getRules(PermanentImpl.java:261)
    at mage.view.CardView.<init>(CardView.java:394)
    at mage.view.CardView.<init>(CardView.java:245)
    at mage.view.PermanentView.<init>(PermanentView.java:39)
    at mage.view.PlayerView.<init>(PlayerView.java:102)
    at mage.view.GameView.<init>(GameView.java:72)
    at mage.server.game.GameSessionWatcher.getGameView(GameSessionWatcher.java:100)
    at mage.server.game.GameSessionWatcher.init(GameSessionWatcher.java:45)
    at mage.server.game.GameController.lambda$watch$3(GameController.java:453)
    at java.util.Optional.ifPresent(Optional.java:159)
    at mage.server.game.GameController.watch(GameController.java:444)
    at mage.server.game.GameManagerImpl.watchGame(GameManagerImpl.java:135)
    at mage.server.MageServerImpl$9.lambda$execute$0(MageServerImpl.java:847)
    at java.util.Optional.map(Optional.java:215)
    at mage.server.MageServerImpl$9.execute(MageServerImpl.java:845)
    at mage.server.MageServerImpl$9.execute(MageServerImpl.java:841)
    at mage.server.MageServerImpl.executeWithResult(MageServerImpl.java:1181)
    at mage.server.MageServerImpl.watchGame(MageServerImpl.java:841)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    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)
ERROR 2022-08-20 08:33:34,714 Exception in rules generation for card: Nezumi Prowler                                     =>[WorkerThread#3[192.168.193.75:63226]] CardUtil.getCardRulesWithAdditionalInfo 
java.util.ConcurrentModificationException
    at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:909)
    at java.util.ArrayList$Itr.next(ArrayList.java:859)
    at mage.abilities.AbilitiesImpl.getRules(AbilitiesImpl.java:51)
    at mage.abilities.AbilitiesImpl.getRules(AbilitiesImpl.java:44)
    at mage.util.CardUtil.getCardRulesWithAdditionalInfo(CardUtil.java:1117)
    at mage.util.CardUtil.getCardRulesWithAdditionalInfo(CardUtil.java:1105)
    at mage.cards.CardImpl.getRules(CardImpl.java:217)
    at mage.game.permanent.PermanentImpl.getRules(PermanentImpl.java:261)
    at mage.view.PermanentView.<init>(PermanentView.java:41)
    at mage.view.PlayerView.<init>(PlayerView.java:102)
    at mage.view.GameView.<init>(GameView.java:72)
    at mage.server.game.GameSessionWatcher.getGameView(GameSessionWatcher.java:100)
    at mage.server.game.GameSessionWatcher.init(GameSessionWatcher.java:45)
    at mage.server.game.GameController.lambda$watch$3(GameController.java:453)
    at java.util.Optional.ifPresent(Optional.java:159)
    at mage.server.game.GameController.watch(GameController.java:444)
    at mage.server.game.GameManagerImpl.watchGame(GameManagerImpl.java:135)
    at mage.server.MageServerImpl$9.lambda$execute$0(MageServerImpl.java:847)
    at java.util.Optional.map(Optional.java:215)
    at mage.server.MageServerImpl$9.execute(MageServerImpl.java:845)
    at mage.server.MageServerImpl$9.execute(MageServerImpl.java:841)
    at mage.server.MageServerImpl.executeWithResult(MageServerImpl.java:1181)
    at mage.server.MageServerImpl.watchGame(MageServerImpl.java:841)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    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)
ERROR 2022-08-20 08:33:34,715 Exception in rules generation for card: Ironhoof Boar                                      =>[WorkerThread#3[192.168.193.75:63226]] CardUtil.getCardRulesWithAdditionalInfo 
java.util.ConcurrentModificationException
    at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:909)
    at java.util.ArrayList$Itr.next(ArrayList.java:859)
    at mage.abilities.AbilitiesImpl.getRules(AbilitiesImpl.java:51)
    at mage.abilities.AbilitiesImpl.getRules(AbilitiesImpl.java:44)
    at mage.util.CardUtil.getCardRulesWithAdditionalInfo(CardUtil.java:1117)
    at mage.util.CardUtil.getCardRulesWithAdditionalInfo(CardUtil.java:1105)
    at mage.cards.CardImpl.getRules(CardImpl.java:217)
    at mage.game.permanent.PermanentImpl.getRules(PermanentImpl.java:261)
    at mage.view.CardView.<init>(CardView.java:394)
    at mage.view.CardView.<init>(CardView.java:245)
    at mage.view.PermanentView.<init>(PermanentView.java:39)
    at mage.view.PlayerView.<init>(PlayerView.java:102)
    at mage.view.GameView.<init>(GameView.java:72)
    at mage.server.game.GameSessionWatcher.getGameView(GameSessionWatcher.java:100)
    at mage.server.game.GameSessionWatcher.init(GameSessionWatcher.java:45)
    at mage.server.game.GameController.lambda$watch$3(GameController.java:453)
    at java.util.Optional.ifPresent(Optional.java:159)
    at mage.server.game.GameController.watch(GameController.java:444)
    at mage.server.game.GameManagerImpl.watchGame(GameManagerImpl.java:135)
    at mage.server.MageServerImpl$9.lambda$execute$0(MageServerImpl.java:847)
    at java.util.Optional.map(Optional.java:215)
    at mage.server.MageServerImpl$9.execute(MageServerImpl.java:845)
    at mage.server.MageServerImpl$9.execute(MageServerImpl.java:841)
    at mage.server.MageServerImpl.executeWithResult(MageServerImpl.java:1181)
    at mage.server.MageServerImpl.watchGame(MageServerImpl.java:841)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    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)
ERROR 2022-08-20 08:33:34,716 Exception in rules generation for card: Roadside Reliquary                                 =>[WorkerThread#3[192.168.193.75:63226]] CardUtil.getCardRulesWithAdditionalInfo 
java.util.ConcurrentModificationException
    at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:909)
    at java.util.ArrayList$Itr.next(ArrayList.java:859)
    at mage.abilities.AbilitiesImpl.getRules(AbilitiesImpl.java:51)
    at mage.abilities.AbilitiesImpl.getRules(AbilitiesImpl.java:44)
    at mage.util.CardUtil.getCardRulesWithAdditionalInfo(CardUtil.java:1117)
    at mage.util.CardUtil.getCardRulesWithAdditionalInfo(CardUtil.java:1105)
    at mage.cards.CardImpl.getRules(CardImpl.java:217)
    at mage.game.permanent.PermanentImpl.getRules(PermanentImpl.java:261)
    at mage.view.CardView.<init>(CardView.java:394)
    at mage.view.CardView.<init>(CardView.java:245)
    at mage.view.PermanentView.<init>(PermanentView.java:39)
    at mage.view.PlayerView.<init>(PlayerView.java:102)
    at mage.view.GameView.<init>(GameView.java:72)
    at mage.server.game.GameSessionWatcher.getGameView(GameSessionWatcher.java:100)
    at mage.server.game.GameSessionWatcher.init(GameSessionWatcher.java:45)
    at mage.server.game.GameController.lambda$watch$3(GameController.java:453)
    at java.util.Optional.ifPresent(Optional.java:159)
    at mage.server.game.GameController.watch(GameController.java:444)
    at mage.server.game.GameManagerImpl.watchGame(GameManagerImpl.java:135)
    at mage.server.MageServerImpl$9.lambda$execute$0(MageServerImpl.java:847)
    at java.util.Optional.map(Optional.java:215)
    at mage.server.MageServerImpl$9.execute(MageServerImpl.java:845)
    at mage.server.MageServerImpl$9.execute(MageServerImpl.java:841)
    at mage.server.MageServerImpl.executeWithResult(MageServerImpl.java:1181)
    at mage.server.MageServerImpl.watchGame(MageServerImpl.java:841)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    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)
ERROR 2022-08-20 08:33:34,718 Exception in rules generation for card: Mirror Box                                         =>[WorkerThread#3[192.168.193.75:63226]] CardUtil.getCardRulesWithAdditionalInfo 
java.util.ConcurrentModificationException
    at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:909)
    at java.util.ArrayList$Itr.next(ArrayList.java:859)
    at mage.abilities.AbilitiesImpl.getRules(AbilitiesImpl.java:51)
    at mage.abilities.AbilitiesImpl.getRules(AbilitiesImpl.java:44)
    at mage.util.CardUtil.getCardRulesWithAdditionalInfo(CardUtil.java:1117)
    at mage.util.CardUtil.getCardRulesWithAdditionalInfo(CardUtil.java:1105)
    at mage.cards.CardImpl.getRules(CardImpl.java:217)
    at mage.game.permanent.PermanentImpl.getRules(PermanentImpl.java:261)
    at mage.view.PermanentView.<init>(PermanentView.java:41)
    at mage.view.PlayerView.<init>(PlayerView.java:102)
    at mage.view.GameView.<init>(GameView.java:72)
    at mage.server.game.GameSessionWatcher.getGameView(GameSessionWatcher.java:100)
    at mage.server.game.GameSessionWatcher.init(GameSessionWatcher.java:45)
    at mage.server.game.GameController.lambda$watch$3(GameController.java:453)
    at java.util.Optional.ifPresent(Optional.java:159)
    at mage.server.game.GameController.watch(GameController.java:444)
    at mage.server.game.GameManagerImpl.watchGame(GameManagerImpl.java:135)
    at mage.server.MageServerImpl$9.lambda$execute$0(MageServerImpl.java:847)
    at java.util.Optional.map(Optional.java:215)
    at mage.server.MageServerImpl$9.execute(MageServerImpl.java:845)
    at mage.server.MageServerImpl$9.execute(MageServerImpl.java:841)
    at mage.server.MageServerImpl.executeWithResult(MageServerImpl.java:1181)
    at mage.server.MageServerImpl.watchGame(MageServerImpl.java:841)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    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)
ERROR 2022-08-20 08:33:34,721 Exception in rules generation for card: Gloomshrieker                                      =>[WorkerThread#3[192.168.193.75:63226]] CardUtil.getCardRulesWithAdditionalInfo 
java.util.ConcurrentModificationException
    at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:909)
    at java.util.ArrayList$Itr.next(ArrayList.java:859)
    at mage.abilities.AbilitiesImpl.getRules(AbilitiesImpl.java:51)
    at mage.abilities.AbilitiesImpl.getRules(AbilitiesImpl.java:44)
    at mage.util.CardUtil.getCardRulesWithAdditionalInfo(CardUtil.java:1117)
    at mage.util.CardUtil.getCardRulesWithAdditionalInfo(CardUtil.java:1105)
    at mage.cards.CardImpl.getRules(CardImpl.java:217)
    at mage.game.permanent.PermanentImpl.getRules(PermanentImpl.java:261)
    at mage.view.PermanentView.<init>(PermanentView.java:41)
    at mage.view.PlayerView.<init>(PlayerView.java:102)
    at mage.view.GameView.<init>(GameView.java:72)
    at mage.server.game.GameSessionWatcher.getGameView(GameSessionWatcher.java:100)
    at mage.server.game.GameSessionWatcher.init(GameSessionWatcher.java:45)
    at mage.server.game.GameController.lambda$watch$3(GameController.java:453)
    at java.util.Optional.ifPresent(Optional.java:159)
    at mage.server.game.GameController.watch(GameController.java:444)
    at mage.server.game.GameManagerImpl.watchGame(GameManagerImpl.java:135)
    at mage.server.MageServerImpl$9.lambda$execute$0(MageServerImpl.java:847)
    at java.util.Optional.map(Optional.java:215)
    at mage.server.MageServerImpl$9.execute(MageServerImpl.java:845)
    at mage.server.MageServerImpl$9.execute(MageServerImpl.java:841)
    at mage.server.MageServerImpl.executeWithResult(MageServerImpl.java:1181)
    at mage.server.MageServerImpl.watchGame(MageServerImpl.java:841)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    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)
JayDi85 commented 11 months ago

Just an idea - AI game can generates too much game events for watching/playing human. Server must send all that events for a client. It uses another thread for that task. Time to collect and send new game update is much larger than time for ai to play next priority, so that game update (game view creating) can catch concurrent modification error.

If true then there are possible fixes:

  1. Good: make thread safe game copy and use it for any callbacks instead real game (deep copy must be faster than all that rules generating code). Improved usage (???): create and store thread safe game copy by game itself, so any read only operations can use it instead a real game;
  2. Maybe good, maybe bad (also can used as additional network/traffic/cpu optimization): use game events queue for sending to client side and remove outdated events from it. It looks like current un-sync game updates logic from client side, but for a server.
phughk commented 9 months ago

Not duplicate but similar to #11848 . This issue requires separate fixes to that one.

JayDi85 commented 9 months ago

@phughk server side errors with ConcurrentModificationException (CardView or getRules in error stack are good mark of it) related to wrong game/call threads, see more details in #11460