Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reconnect does not work correctly #502

Closed
LevelX2 opened this issue Aug 11, 2014 · 5 comments
Closed

Reconnect does not work correctly #502

LevelX2 opened this issue Aug 11, 2014 · 5 comments

Comments

@LevelX2
Copy link
Contributor

@LevelX2 LevelX2 commented Aug 11, 2014

Currently the reconnect to games / tournaments does not work correctly.

If I test it local by killing a client it works.
But on public server it does not work.

It seems like connection lost is handled like a manual disconnect.

Any ideas / suggestions are welcome.

@LevelX2
Copy link
Contributor Author

@LevelX2 LevelX2 commented Aug 11, 2014

Here are some log example of my own disconnect during a tournament match:
Server log:

DEBUG 2014-08-11 20:25:21,753 Game created: Two Player Duel                                                              =>[pool-1-thread-55] GameFactory.createMatch
DEBUG 2014-08-11 20:25:21,753 Deck validator created: Limited                                                            =>[pool-1-thread-55] DeckValidatorFactory.createDeckValidator
INFO  2014-08-11 20:25:21,754 Tourn. match started id:2101bd45-f471-4932-8303-772ee29054e6 tournId: 6c9213ce-96d6-4938-9cda-6715e6aa324b =>[pool-1-thread-55] TableController.startMatch
INFO  2014-08-11 20:25:21,959 GAME started [] Bandit - Merciptar                                                         =>[pool-1-thread-55] TableController.startGame
DEBUG 2014-08-11 20:25:21,959 - matchId: 2101bd45-f471-4932-8303-772ee29054e6 []                                         =>[pool-1-thread-55] TableController.startGame
DEBUG 2014-08-11 20:25:21,960 - gameId:  d388e8f6-9651-4d14-9a8f-0162b9d482a1                                            =>[pool-1-thread-55] TableController.startGame
DEBUG 2014-08-11 20:25:21,960 - chatId:  e0aa4a6a-88d9-4bc1-9cc8-923434ae6694                                            =>[pool-1-thread-55] TableController.startGame
DEBUG 2014-08-11 20:25:22,108 Bandit joined chat e0aa4a6a-88d9-4bc1-9cc8-923434ae6694                                    =>[pool-1-thread-118] ChatSession.join
DEBUG 2014-08-11 20:25:22,139 Player 86b18f0c-3332-4f4a-a8a4-a74b0d3e43f3 has joined game d388e8f6-9651-4d14-9a8f-0162b9d482a1 =>[pool-1-thread-118] GameController.join
DEBUG 2014-08-11 20:25:22,920 Merciptar joined chat e0aa4a6a-88d9-4bc1-9cc8-923434ae6694                                 =>[pool-1-thread-118] ChatSession.join
DEBUG 2014-08-11 20:25:22,963 Player 04bf59ac-eb21-4063-a7a3-a591d34c568c has joined game d388e8f6-9651-4d14-9a8f-0162b9d482a1 =>[pool-1-thread-118] GameController.join





DEBUG 2014-08-11 20:39:11,571 User Bandit will be removed (Disconnected)  userId: aeffb694-e283-43ee-b891-f76b01971c47   =>[WorkerThread#17[93.222.207.244:53787]] UserManager.removeUser
DEBUG 2014-08-11 20:39:11,572 Game sessions: 1                                                                           =>[WorkerThread#17[93.222.207.244:53787]] User.kill
DEBUG 2014-08-11 20:39:11,572 -- kill game session of gameId: d388e8f6-9651-4d14-9a8f-0162b9d482a1                       =>[WorkerThread#17[93.222.207.244:53787]] User.kill
DEBUG 2014-08-11 20:39:11,572 before game.quit playerId:86b18f0c-3332-4f4a-a8a4-a74b0d3e43f3                             =>[WorkerThread#17[93.222.207.244:53787]] GameSession.kill
DEBUG 2014-08-11 20:39:11,572 GameImpl.quit start 86b18f0c-3332-4f4a-a8a4-a74b0d3e43f3                                   =>[WorkerThread#17[93.222.207.244:53787]] GameImpl.quit
DEBUG 2014-08-11 20:39:11,573 GameImpl.quit Bandit quits the game                                                        =>[WorkerThread#17[93.222.207.244:53787]] GameImpl.quit
DEBUG 2014-08-11 20:39:11,573 PlayerImpl.quit start Bandit quits game d388e8f6-9651-4d14-9a8f-0162b9d482a1               =>[WorkerThread#17[93.222.207.244:53787]] PlayerImpl.quit
DEBUG 2014-08-11 20:39:11,575 PlayerImpl.quit before concedeBandit quits game d388e8f6-9651-4d14-9a8f-0162b9d482a1       =>[WorkerThread#17[93.222.207.244:53787]] PlayerImpl.quit
DEBUG 2014-08-11 20:39:11,575 Bandit concedes gameId:d388e8f6-9651-4d14-9a8f-0162b9d482a1                                =>[WorkerThread#17[93.222.207.244:53787]] PlayerImpl.concede
DEBUG 2014-08-11 20:39:11,575 game.gameOver -> player leaves 86b18f0c-3332-4f4a-a8a4-a74b0d3e43f3                        =>[WorkerThread#17[93.222.207.244:53787]] GameImpl.gameOver
DEBUG 2014-08-11 20:39:11,575 game.leave -> start  player: Bandit                                                        =>[WorkerThread#17[93.222.207.244:53787]] GameImpl.leave
DEBUG 2014-08-11 20:39:11,576 game.checkIfGameIsOver ->Player Merciptar won the game d388e8f6-9651-4d14-9a8f-0162b9d482a1 =>[WorkerThread#17[93.222.207.244:53787]] GameImpl.checkIfGameIsOver
DEBUG 2014-08-11 20:39:11,576 player won -> start: Merciptar                                                             =>[WorkerThread#17[93.222.207.244:53787]] PlayerImpl.won
DEBUG 2014-08-11 20:39:11,576 player won -> No more oppononets alive game won: Merciptar                                 =>[WorkerThread#17[93.222.207.244:53787]] PlayerImpl.won
DEBUG 2014-08-11 20:39:11,577 Before lost Bandit                                                                         =>[WorkerThread#17[93.222.207.244:53787]] PlayerImpl.concede
DEBUG 2014-08-11 20:39:11,577 player lost -> start: Bandit                                                               =>[WorkerThread#17[93.222.207.244:53787]] PlayerImpl.lost
DEBUG 2014-08-11 20:39:11,578 After lost Bandit                                                                          =>[WorkerThread#17[93.222.207.244:53787]] PlayerImpl.concede
DEBUG 2014-08-11 20:39:11,578 GameImpl.quit end 86b18f0c-3332-4f4a-a8a4-a74b0d3e43f3                                     =>[WorkerThread#17[93.222.207.244:53787]] GameImpl.quit
DEBUG 2014-08-11 20:39:11,578 Draft sessions 0                                                                           =>[WorkerThread#17[93.222.207.244:53787]] User.kill
DEBUG 2014-08-11 20:39:11,578 Tournament sessions 1                                                                      =>[WorkerThread#17[93.222.207.244:53787]] User.kill
DEBUG 2014-08-11 20:39:11,578 Tables 1                                                                                   =>[WorkerThread#17[93.222.207.244:53787]] User.kill
DEBUG 2014-08-11 20:39:11,578 -- leave tableId: 29729dac-9a6a-4244-a337-83b9d1bbbd47                                     =>[WorkerThread#17[93.222.207.244:53787]] User.kill
DEBUG 2014-08-11 20:39:11,579 TABLE leave - userId: aeffb694-e283-43ee-b891-f76b01971c47  tableId: 29729dac-9a6a-4244-a337-83b9d1bbbd47 =>[WorkerThread#17[93.222.207.244:53787]] TableManager.leaveTable
DEBUG 2014-08-11 20:39:11,579 Quit tournament sub tables for userId: aeffb694-e283-43ee-b891-f76b01971c47                =>[WorkerThread#17[93.222.207.244:53787]] TableController.leaveTable
ERROR 2014-08-11 20:39:11,579 No playerId found for userId: aeffb694-e283-43ee-b891-f76b01971c47                         =>[WorkerThread#17[93.222.207.244:53787]] TableController.leaveTable
ERROR 2014-08-11 20:39:11,579 No playerId found for userId: aeffb694-e283-43ee-b891-f76b01971c47                         =>[WorkerThread#17[93.222.207.244:53787]] TableController.leaveTable
DEBUG 2014-08-11 20:39:11,579 Quit tournament  Id: 6c9213ce-96d6-4938-9cda-6715e6aa324b                                  =>[WorkerThread#17[93.222.207.244:53787]] TableController.leaveTable
DEBUG 2014-08-11 20:39:11,580 GameImpl.quit start 86b18f0c-3332-4f4a-a8a4-a74b0d3e43f3                                   =>[WorkerThread#17[93.222.207.244:53787]] GameImpl.quit
DEBUG 2014-08-11 20:39:11,580 GameImpl.quit Bandit quits the game                                                        =>[WorkerThread#17[93.222.207.244:53787]] GameImpl.quit
DEBUG 2014-08-11 20:39:11,580 PlayerImpl.quit start Bandit quits game d388e8f6-9651-4d14-9a8f-0162b9d482a1               =>[WorkerThread#17[93.222.207.244:53787]] PlayerImpl.quit
DEBUG 2014-08-11 20:39:11,581 PlayerImpl.quit before concedeBandit quits game d388e8f6-9651-4d14-9a8f-0162b9d482a1       =>[WorkerThread#17[93.222.207.244:53787]] PlayerImpl.quit
DEBUG 2014-08-11 20:39:11,581 Bandit concedes gameId:d388e8f6-9651-4d14-9a8f-0162b9d482a1                                =>[WorkerThread#17[93.222.207.244:53787]] PlayerImpl.concede
DEBUG 2014-08-11 20:39:11,581 game.gameOver -> player leaves 86b18f0c-3332-4f4a-a8a4-a74b0d3e43f3                        =>[WorkerThread#17[93.222.207.244:53787]] GameImpl.gameOver
DEBUG 2014-08-11 20:39:11,581 game.leave -> player already left Bandit                                                   =>[WorkerThread#17[93.222.207.244:53787]] GameImpl.leave
DEBUG 2014-08-11 20:39:11,582 Before lost Bandit                                                                         =>[WorkerThread#17[93.222.207.244:53787]] PlayerImpl.concede
DEBUG 2014-08-11 20:39:11,582 player lost -> start: Bandit                                                               =>[WorkerThread#17[93.222.207.244:53787]] PlayerImpl.lost
DEBUG 2014-08-11 20:39:11,582 After lost Bandit                                                                          =>[WorkerThread#17[93.222.207.244:53787]] PlayerImpl.concede
DEBUG 2014-08-11 20:39:11,582 GameImpl.quit end 86b18f0c-3332-4f4a-a8a4-a74b0d3e43f3                                     =>[WorkerThread#17[93.222.207.244:53787]] GameImpl.quit
DEBUG 2014-08-11 20:39:11,583 GameImpl.findWinnersAndLosers start gameId d388e8f6-9651-4d14-9a8f-0162b9d482a1            =>[pool-2-thread-62] GameImpl.findWinnersAndLosers
DEBUG 2014-08-11 20:39:11,583 GameImpl.findWinnersAndLosers playerHasWon 04bf59ac-eb21-4063-a7a3-a591d34c568c            =>[pool-2-thread-62] GameImpl.findWinnersAndLosers
INFO  2014-08-11 20:39:11,583 GAME ended  gameId: d388e8f6-9651-4d14-9a8f-0162b9d482a1                                   =>[pool-2-thread-62] GameImpl.play
DEBUG 2014-08-11 20:39:11,587 Chat removed - chatId: e0aa4a6a-88d9-4bc1-9cc8-923434ae6694                                =>[pool-2-thread-62] ChatManager.destroyChatSession
DEBUG 2014-08-11 20:39:11,587 Chat removed - chatId: a4dd5cf0-cc49-4263-9d51-28dc79ab53e0                                =>[pool-2-thread-62] ChatManager.destroyChatSession
DEBUG 2014-08-11 20:39:11,587 Chat remove user                                                                           =>[WorkerThread#17[93.222.207.244:53787]] User.kill
DEBUG 2014-08-11 20:39:11,588 Bandit(Disconnected) removed from chatId 3e0b3a85-ec3e-4d11-8a91-7ad2a21bdb2b              =>[WorkerThread#17[93.222.207.244:53787]] ChatSession.kill
DEBUG 2014-08-11 20:39:22,629 Bandit(Disconnected) removed from chatId 5f0f1397-458f-4f64-8d3a-44eeb7672fca              =>[WorkerThread#17[93.222.207.244:53787]] ChatSession.kill
DEBUG 2014-08-11 20:39:22,631 Bandit(Disconnected) removed from chatId 66a1d46b-53c0-49d5-8654-2625aace2173              =>[WorkerThread#17[93.222.207.244:53787]] ChatSession.kill
DEBUG 2014-08-11 20:39:22,631 User Bandit removed                                                                        =>[WorkerThread#17[93.222.207.244:53787]] UserManager.removeUser
DEBUG 2014-08-11 20:39:22,633 Client disconnected - Bandit at 93.222.207.244 sessionId: 5c4o4yo-x11did-hyq1ck3k-1-hyq1ck5s-4 =>[WorkerThread#17[93.222.207.244:53787]] Main$ClientConnectionListener.handleConnectionException

DEBUG 2014-08-11 20:39:49,587 Created user Bandit id: 76fccbc8-86ff-40d7-94ec-858135b87e5a                               =>[WorkerThread#15[93.222.207.244:53814]] User.setSessionId
INFO  2014-08-11 20:39:49,600 Bandit joined server                                                                       =>[WorkerThread#15[93.222.207.244:53814]] SessionManager.registerUser
DEBUG 2014-08-11 20:39:49,600 - userId:    76fccbc8-86ff-40d7-94ec-858135b87e5a                                          =>[WorkerThread#15[93.222.207.244:53814]] SessionManager.registerUser
DEBUG 2014-08-11 20:39:49,601 - sessionId: 5c4o4yo-vzg4k-hyq5af5e-1-hyq5af7c-4                                           =>[WorkerThread#15[93.222.207.244:53814]] SessionManager.registerUser
DEBUG 2014-08-11 20:39:49,601 - host:      93.222.207.244                                                                =>[WorkerThread#15[93.222.207.244:53814]] SessionManager.registerUser
WARN  2014-08-11 20:39:50,496 MTGO Holiday Cube 2013 - Card not found: Thornscape Battlemage:                            =>[pool-1-thread-55] DraftCube.createBooster
WARN  2014-08-11 20:39:50,538 MTGO Holiday Cube 2013 - Card not found: Sarcomancy:                                       =>[pool-1-thread-55] DraftCube.createBooster
DEBUG 2014-08-11 20:39:53,699 Bandit joined chat 3e0b3a85-ec3e-4d11-8a91-7ad2a21bdb2b                                    =>[pool-1-thread-130] ChatSession.join

Client Log:

INFO  2014-08-11 20:13:43,557 Tournament 6c9213ce-96d6-4938-9cda-6715e6aa324b started for player 86b18f0c-3332-4f4a-a8a4-a74b0d3e43f3 =>[AWT-EventQueue-0] CallbackClientImpl.tournamentStarted 
INFO  2014-08-11 20:24:17,323 Showing tournament table 4ebafc68-1fe9-4546-b8fb-03e479a7d4a6                              =>[AWT-EventQueue-0] TablesPanel$1.actionPerformed 
INFO  2014-08-11 20:24:17,613 Showing tournament 41780759-201f-44c6-bddc-9ffc83772ba0                                    =>[AWT-EventQueue-0] CallbackClientImpl.showTournament 
INFO  2014-08-11 20:25:27,496 Game d388e8f6-9651-4d14-9a8f-0162b9d482a1 started for player 86b18f0c-3332-4f4a-a8a4-a74b0d3e43f3 =>[AWT-EventQueue-0] CallbackClientImpl.gameStarted 
INFO  2014-08-11 20:39:16,703 connection to server lost - Could not connect to server!                                   =>[Thread-7216] SessionImpl$ClientConnectionListener.handleConnectionException 
INFO  2014-08-11 20:39:27,864 Disconnected ...                                                                           =>[Thread-7216] SessionImpl.disconnect 
FATAL 2014-08-11 20:39:35,115                                                                                            =>[AWT-EventQueue-0] EDTExceptionHandler.handle 
java.lang.NullPointerException
    at mage.client.tournament.TournamentPanel.update(TournamentPanel.java:212)
    at mage.client.tournament.UpdateTournamentTask.process(TournamentPanel.java:693)
    at javax.swing.SwingWorker$3.run(Unknown Source)
    at sun.swing.AccumulativeRunnable.run(Unknown Source)
    at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.run(Unknown Source)
    at sun.swing.AccumulativeRunnable.run(Unknown Source)
    at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.actionPerformed(Unknown Source)
    at javax.swing.Timer.fireActionPerformed(Unknown Source)
    at javax.swing.Timer$DoPostEvent.run(Unknown Source)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$200(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
INFO  2014-08-11 20:39:47,535 Loading plugins...                                                                         =>[AWT-EventQueue-0] Plugins.loadPlugins 
INFO  2014-08-11 20:39:47,595 [Game counter plugin, version 0.1] has been loaded.                                        =>[AWT-EventQueue-0] CounterPluginImpl.newPlugin 
INFO  2014-08-11 20:39:47,605 Done.                                                                                      =>[AWT-EventQueue-0] Plugins.loadPlugins 
INFO  2014-08-11 20:39:48,265 Client start up time: 3 seconds                                                            =>[AWT-EventQueue-0] MageFrame$6.run 
INFO  2014-08-11 20:39:57,818 Connected as Bandit to MAGE server at 176.31.186.181:17171                                 =>[SwingWorker-pool-4-thread-2] SessionImpl.connect 
INFO  2014-08-11 20:50:45,257 Showing tournament table 4ebafc68-1fe9-4546-b8fb-03e479a7d4a6                              =>[AWT-EventQueue-0] TablesPanel$2.actionPerformed 
@JeffHoogland
Copy link

@JeffHoogland JeffHoogland commented Aug 12, 2014

My question is - why do you need to handle manual disconnects differently from connection losses? Could you simply make it so if one play disconnects for any reason - as long as one player stays connected, the game will exist still giving the other a chance to reconnect?

To help with server issues, I think it would also be a good idea to have some sort of time (5-10 minutes maybe?) where if both players disconnect it doesn't immediately end the match. This gives one or both parties a chance to reconnect right away and not let the current match be lost.

@LevelX2
Copy link
Contributor Author

@LevelX2 LevelX2 commented Aug 12, 2014

The point is that people playing and if they are loosing or stop playing for other reasons, they often simply close XMage and don't concede the match regularly. So in all this cases (and believe me this happens a lot), your game and you would hang around for some more 5-10 minutes until the game ends.

But at least it would be a possible direction to go. Maybe we could ask the user while closing XMage if he want's to quit all running matches/tournaments (set "yes" to default) and if the server does not get this response explicit, we handle it as a "lost of connection". So all unexpected disconnect reasons should be handled as "lost of connection" and the user should be able to reconnect.

@LevelX2
Copy link
Contributor Author

@LevelX2 LevelX2 commented Jan 5, 2015

Another problem with reconnect I identified is that for every reconnect the card db check for new cards is done. That slows down the server especially if multiple clients get disconnected at the same time and try to reconnect. Than the h2 db requests are probably a bottleneck.
And for the reconnects the db check can be skipped anyway.
For normal connect I will add an option if the db check should be done.

@goesta
Copy link
Contributor

@goesta goesta commented Feb 28, 2017

I'll close this issue because it seems to be outdated.

@goesta goesta closed this Feb 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants