Page 1 of 1

Getting stuck "Waiting for opponent..." after exception

PostPosted: 03 Feb 2015, 04:26
by hervebronnimann
Here's a simple suggestion, I'd like to hear from others what they think. While testing a draft deck, I sometimes encounter a bug (NPE, CME, ...) that kills the app, and forces me to close and restart. The thread that gets killed by the exception is like this (I take from a recent stack trace):
Code: Select all
   at forge.game.GameAction.startGame(GameAction.java:1390)
   at forge.game.Match.startGame(Match.java:71)
   at forge.match.MatchUtil$2.run(MatchUtil.java:202)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
   at java.lang.Thread.run(Thread.java:722)
Now I like very much the popup window that shows up with the bug report, but essentially the app is still dead: I cannot start a new game. It would be very simple to put a try/catch block around startGame, for instance, and the catch block could simply wait for the completion of the action on the popup window (if it is guaranteed that one is created upon exceptions) and simply close the game.

Now there are two things I am missing in order to test this. One: I closed the app before I did a thread dump, so I do not know which thread processes the bug report window, and where that code lives. (I'll find out eventually, when that happens again, but in case anyone of you knows...)

Two: concerning the best resolution... Would players in general appreciate being able to continue with their game after a crash? (It may be unfair, tho, to ignore the exception inside the game loop). Personally I think the best behavior would be to assume a draw, or simply give the option to restart round or quit (if in a draft), or whatever the normal behavior is at the end of the game. Perhaps introducing a new GameOutcome value for ENDS_WITH_ERROR. What do y'all think?