Bug - Fixed Error when encountering a fight or a choice adventure when logging on

slyz

Developer
When Mafia encounters a fight page during logon, the user used to open the relay browser and finish the fight so that Mafia could continue the session initialization. Now, it looks like the session isn't correctly initialized once the fight is over:
Code:
Validating login server (www.kingdomofloathing.com)...
535 players online.
Sending login request...
Using data override: data/mallprices.txt
Using data override: data/mallprices.txt
Using data override: data/mallprices.txt
Initializing session for slyz...
Refreshing session data...
Loading character status...
Synchronizing moon data...
Retrieving character data...
[color=red]Redirected to a fight page.
Redirected to a fight page.
Redirected to a fight page.
Redirected to a fight page.
Redirected to a fight page.
Redirected to a fight page.
Redirected to a fight page.
Redirected to a fight page.[/color]
I got this debug log:
Code:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
         KoLmafia v14.8 r9992, Windows XP, Java 1.6.0_24
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Please note: do not post this log in the KoLmafia thread. If you
 would like the dev team to look at it, please write a bug report
 at kolmafia.us. Include specific information about what you were 
 doing when you made this and include the log as an attachment.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Timestamp: Thu Nov 10 12:54:39 CET 2011
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


class java.util.ConcurrentModificationException: null
java.util.ConcurrentModificationException
	at java.util.AbstractList$Itr.checkForComodification(Unknown Source)
	at java.util.AbstractList$Itr.next(Unknown Source)
	at java.util.Collections.sort(Unknown Source)
	at net.java.dev.spellcast.utilities.LockableListModel.sort(LockableListModel.java:162)
	at net.sourceforge.kolmafia.persistence.ConcoctionDatabase.refreshConcoctions(ConcoctionDatabase.java:1381)
	at net.sourceforge.kolmafia.persistence.ConcoctionDatabase.deferRefresh(ConcoctionDatabase.java:1119)
	at net.sourceforge.kolmafia.KoLmafia.login(KoLmafia.java:708)
	at net.sourceforge.kolmafia.request.LoginRequest.processLoginRequest(LoginRequest.java:425)
	at net.sourceforge.kolmafia.request.GenericRequest.handleServerRedirect(GenericRequest.java:1601)
	at net.sourceforge.kolmafia.request.GenericRequest.retrieveServerReply(GenericRequest.java:1532)
	at net.sourceforge.kolmafia.request.GenericRequest.execute(GenericRequest.java:1259)
	at net.sourceforge.kolmafia.request.GenericRequest.run(GenericRequest.java:1161)
	at net.sourceforge.kolmafia.request.LoginRequest.run(LoginRequest.java:279)
	at net.sourceforge.kolmafia.RequestThread.postRequest(RequestThread.java:86)
	at net.sourceforge.kolmafia.KoLmafiaGUI.initialize(KoLmafiaGUI.java:120)
	at net.sourceforge.kolmafia.KoLmafia.main(KoLmafia.java:486)
Error during session initialization
After I open the Relay Browser and finish the fight, Mafia runs my login script:
Code:
KoLmafia thinks it is round 2 but KoL thinks it is round 1
Round 2: slyz attacks!
KoLmafia thinks it is round 3 but KoL thinks it is round 2
Round 3: takes 2719 damage.
Round 3: Ieva mimics a red-and-white striped barber pole, spinning in front of your opponent. He looks mesmerized.
Round 3: drops 18 attack power.
Round 3: drops 18 defense.
Round 3: slyz wins the fight!
You gain 6 Meat
After Battle: Ieva gorges himself on candy from his bag.
You gain 2 Strongness
You have a present under the Crimbo tree in your clan's VIP lounge!
3 prices updated from http://kolmafia.us/scripts/updateprices.php?action=getmap
Running ZLib version: r31 (current)
Running Script Registry version: 1.7 (current)
...
In the gCLI, this output is missing, when compared to a normal logon:
Code:
Refreshing closet...
Examining consumables in closet...
Examining equipment in closet...
Examining miscellaneous items in closet...
Updating inventory...
Retrieving familiar data...
Familiar data retrieved.
Retrieving campground data...
Session data refreshed.
It looks like all of this was actually done after the fight, but doesn't appear in the gCLI: Mafia stayed in an ABORT_STATE, but knew about all my gear, familiars, inventory and creatables.

All of the above are called in KoLMafia.refreshSessionData() by doing a RequestThread.postRequest( new SomethingRequest ). However, the gCLI shows "You have a present under the Crimbo tree in your clan's VIP lounge!", which comes from a ClanLoungeRequest called by doing ClanLoungeRequest.visitLounge() instead of using RequestThread.postRequest().

Since r9853, Mafia should also handle encountering a choice adventure when you log on. This is what happens now:
Code:
Validating login server (www.kingdomofloathing.com)...
535 players online.
Sending login request...
Using data override: data/mallprices.txt
Using data override: data/mallprices.txt
Using data override: data/mallprices.txt
Initializing session for slyz...
Refreshing session data...
Loading character status...
Synchronizing moon data...
Retrieving character data...
[color=red]Redirected to a choice page.
Redirected to a choice page.
Redirected to a choice page.
Redirected to a choice page.
Redirected to a choice page.
Redirected to a choice page.
Redirected to a choice page.[/color]
Unexpected error, debug log printed.
[color=red]Unsupported choice adventure #359
Click here to continue in the relay browser.[/color]
and the debug log:
Code:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
         KoLmafia v14.8 r9992, Windows XP, Java 1.6.0_24
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Please note: do not post this log in the KoLmafia thread. If you
 would like the dev team to look at it, please write a bug report
 at kolmafia.us. Include specific information about what you were 
 doing when you made this and include the log as an attachment.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Timestamp: Thu Nov 10 12:44:39 CET 2011
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


Unexpected error, debug log printed.
class java.util.NoSuchElementException: null
java.util.NoSuchElementException
	at java.util.AbstractList$Itr.next(Unknown Source)
	at java.util.Collections.sort(Unknown Source)
	at net.java.dev.spellcast.utilities.LockableListModel.sort(LockableListModel.java:162)
	at net.sourceforge.kolmafia.persistence.ConcoctionDatabase.refreshConcoctions(ConcoctionDatabase.java:1381)
	at net.sourceforge.kolmafia.persistence.MallPriceDatabase.updatePrices(MallPriceDatabase.java:164)
	at net.sourceforge.kolmafia.textui.command.UpdateDataCommand.run(UpdateDataCommand.java:66)
	at net.sourceforge.kolmafia.KoLmafiaCLI.executeCommand(KoLmafiaCLI.java:551)
	at net.sourceforge.kolmafia.KoLmafiaCLI.executeLine(KoLmafiaCLI.java:425)
	at net.sourceforge.kolmafia.KoLmafia.login(KoLmafia.java:735)
	at net.sourceforge.kolmafia.request.LoginRequest.processLoginRequest(LoginRequest.java:425)
	at net.sourceforge.kolmafia.request.GenericRequest.handleServerRedirect(GenericRequest.java:1601)
	at net.sourceforge.kolmafia.request.GenericRequest.retrieveServerReply(GenericRequest.java:1532)
	at net.sourceforge.kolmafia.request.GenericRequest.execute(GenericRequest.java:1259)
	at net.sourceforge.kolmafia.request.GenericRequest.run(GenericRequest.java:1161)
	at net.sourceforge.kolmafia.request.LoginRequest.run(LoginRequest.java:279)
	at net.sourceforge.kolmafia.RequestThread.postRequest(RequestThread.java:86)
	at net.sourceforge.kolmafia.KoLmafiaGUI.initialize(KoLmafiaGUI.java:120)
	at net.sourceforge.kolmafia.KoLmafia.main(KoLmafia.java:486)
After I opened the Relay Browser and exited the choice, my login script started running. Just like with the redirection to a fight page, it looks like everything was initialized, but Mafia was also in an ABORT_STATE and output was missing from the gCLI.
 

Veracity

Developer
Staff member
I've been hoping hola would look at this. I assume it's still happening, since I've seen no commit purporting to fix it. It's a serious bug, in my opinion.
 

slyz

Developer
r10036 seems to have done the trick. The gCLI doesn't show the "click here to continue in the relay browser" link I remember seeing before, but I'll mark this fixed anyway.
 
Top