Bug - Fixed Mafia Randomly Freezes

bumcheekcity

Active member
I'm aware that ranks highly as the least-useful title for a bug report ever. But mafia's been recently just failing to respond in the relay browser, and then all the command queue in the CLI and I end up having to close it down and re-log in.

Just today, I was fighting the gremlins, had fought a few and used my combat macro, at which point, the relay browser did nothing, and all the CLI commands started queueing. I pressed ESCAPE and it gave me "world peace" but future commands did nothing, except increase the CLI queue.

I'll start debug logs when I start mafia and attempt to catch it in action. I appreciate probably nothing can be done without those.
 

Veracity

Developer
Staff member
I pressed ESCAPE and it gave me "world peace" but future commands did nothing, except increase the CLI queue.
This is a previously noted issue. I could probably find a couple open bug reports on this. Perhaps somebody else will. :)

Did you try the "greygui" command?
Are you running with socket timeouts?
 

bumcheekcity

Active member
I managed to grab this one, but wasn't running a debug log for the moment it crashed.

Code:
[738] Sorceress' Hedge Maze
You acquire an item: hedge maze key
Retrieving maze status...
Computing maze solution...
Executing final rotations...
Ran out of puzzle pieces.
BCC: Maximizing ''
Putting on outfit: bumcheekascend
You are already wearing "bumcheekascend."
Equipment changed.
BCC: Nothing to fax according to whatShouldIFax
Resetting mind control device...
Mind control device reset.
BCC: Getting another Hedge Maze
Cleared mood.
Cleared mood.
Set mood trigger: When I get Just the Best Anapests, uneffect just the best anapests
Set mood trigger: When I run low on Go Get 'Em, Tiger!, use 5 Ben-Gal™ Balm
BCC: Need to run a song! Accompaniment chosen by default
Set mood trigger: When I run low on Song of Accompaniment, cast 1 Song of Accompaniment
Purchasing Ben-Gal™ Balm (5 @ 24)...
You acquire Ben-Gal™ Balm (5)
You spent 120 Meat
Purchases complete.
Using 5 Ben-Gal™ Balm...
You acquire an effect: Go Get 'Em, Tiger! (duration: 15 Adventures)
Finished using 5 Ben-Gal™ Balm.
Mood swing complete.
Mood swing complete.
Conditions list cleared.
Condition added: hedge maze puzzle
BCC: Setting goals of '1 hedge maze puzzle'...
BCC: We should set the MCD if we can.
BCC: We CAN set the MCD.
Resetting mind control device...
KoLmafia declares world peace.

> CURRENT: call scripts\dev\bumcheekascend\bumcheekascend.ash
> QUEUED 1: call scripts\dev\bumcheekascend\bumcheekascend.ash

KoLmafia declares world peace.
KoLmafia declares world peace.
KoLmafia declares world peace.
KoLmafia declares world peace.
KoLmafia declares world peace.
KoLmafia declares world peace.
KoLmafia declares world peace.
KoLmafia declares world peace.
KoLmafia declares world peace.
KoLmafia declares world peace.
KoLmafia declares world peace.
KoLmafia declares world peace.
KoLmafia declares world peace.

> CURRENT: call scripts\dev\bumcheekascend\bumcheekascend.ash
> QUEUED 1: call scripts\dev\bumcheekascend\bumcheekascend.ash
> QUEUED 2: call scripts\dev\bumcheekascend\bumcheekascend.ash

KoLmafia declares world peace.
KoLmafia declares world peace.
KoLmafia declares world peace.
KoLmafia declares world peace.
KoLmafia declares world peace.
KoLmafia declares world peace.
KoLmafia declares world peace.
KoLmafia declares world peace.
KoLmafia declares world peace.
KoLmafia declares world peace.
KoLmafia declares world peace.

> CURRENT: call scripts\dev\bumcheekascend\bumcheekascend.ash
> QUEUED 1: call scripts\dev\bumcheekascend\bumcheekascend.ash
> QUEUED 2: call scripts\dev\bumcheekascend\bumcheekascend.ash
> QUEUED 3: call scripts\dev\bumcheekascend\bumcheekascend.ash

KoLmafia declares world peace.
KoLmafia declares world peace.
KoLmafia declares world peace.
KoLmafia declares world peace.
KoLmafia declares world peace.

> CURRENT: call scripts\dev\bumcheekascend\bumcheekascend.ash
> QUEUED 1: call scripts\dev\bumcheekascend\bumcheekascend.ash
> QUEUED 2: call scripts\dev\bumcheekascend\bumcheekascend.ash
> QUEUED 3: call scripts\dev\bumcheekascend\bumcheekascend.ash
> QUEUED 4: eat fortune cookie

KoLmafia declares world peace.

I managed to start the debug log before the QUEUED 2: and then ended it as above.

Code:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
         KoLmafia v15.1 r10810, Windows 7, Java 1.7.0_02
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 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: Mon Mar 19 07:32:43 GMT 2012
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


Unexpected error, debug log printed.
class java.lang.NullPointerException: null
java.lang.NullPointerException
	at net.sourceforge.kolmafia.textui.parsetree.Scope.addCommand(Scope.java:77)
	at net.sourceforge.kolmafia.textui.Parser.parseLoopScope(Parser.java:1937)
	at net.sourceforge.kolmafia.textui.Parser.parseWhile(Parser.java:1382)
	at net.sourceforge.kolmafia.textui.Parser.parseCommand(Parser.java:924)
	at net.sourceforge.kolmafia.textui.Parser.parseConditional(Parser.java:1218)
	at net.sourceforge.kolmafia.textui.Parser.parseCommand(Parser.java:948)
	at net.sourceforge.kolmafia.textui.Parser.parseScope(Parser.java:451)
	at net.sourceforge.kolmafia.textui.Parser.parseConditional(Parser.java:1224)
	at net.sourceforge.kolmafia.textui.Parser.parseCommand(Parser.java:948)
	at net.sourceforge.kolmafia.textui.Parser.parseScope(Parser.java:451)
	at net.sourceforge.kolmafia.textui.Parser.parseFunction(Parser.java:719)
	at net.sourceforge.kolmafia.textui.Parser.parseScope(Parser.java:471)
	at net.sourceforge.kolmafia.textui.Parser.parseFunction(Parser.java:719)
	at net.sourceforge.kolmafia.textui.Parser.parseScope(Parser.java:471)
	at net.sourceforge.kolmafia.textui.Parser.parse(Parser.java:189)
	at net.sourceforge.kolmafia.textui.Interpreter.validate(Interpreter.java:252)
	at net.sourceforge.kolmafia.KoLmafiaASH.getInterpreter(KoLmafiaASH.java:203)
	at net.sourceforge.kolmafia.request.GenericRequest.invokeCounterScript(GenericRequest.java:1032)
	at net.sourceforge.kolmafia.request.GenericRequest.stopForCounters(GenericRequest.java:991)
	at net.sourceforge.kolmafia.request.GenericRequest.run(GenericRequest.java:1137)
	at net.sourceforge.kolmafia.request.AdventureRequest.run(AdventureRequest.java:244)
	at net.sourceforge.kolmafia.RequestThread.postRequest(RequestThread.java:221)
	at net.sourceforge.kolmafia.RequestThread.postRequest(RequestThread.java:184)
	at net.sourceforge.kolmafia.KoLAdventure.run(KoLAdventure.java:1100)
	at net.sourceforge.kolmafia.RequestThread.postRequest(RequestThread.java:221)
	at net.sourceforge.kolmafia.RequestThread.postRequest(RequestThread.java:195)
	at net.sourceforge.kolmafia.KoLmafia.executeAdventureOnce(KoLmafia.java:1405)
	at net.sourceforge.kolmafia.KoLmafia.executeRequestOnce(KoLmafia.java:1425)
	at net.sourceforge.kolmafia.KoLmafia.executeRequest(KoLmafia.java:1296)
	at net.sourceforge.kolmafia.KoLmafia.makeRequest(KoLmafia.java:1159)
	at net.sourceforge.kolmafia.textui.command.AdventureCommand.run(AdventureCommand.java:106)
	at net.sourceforge.kolmafia.KoLmafiaCLI.doExecuteCommand(KoLmafiaCLI.java:548)
	at net.sourceforge.kolmafia.KoLmafiaCLI.executeCommand(KoLmafiaCLI.java:501)
	at net.sourceforge.kolmafia.KoLmafiaCLI.executeLine(KoLmafiaCLI.java:402)
	at net.sourceforge.kolmafia.KoLmafiaCLI.executeLine(KoLmafiaCLI.java:270)
	at net.sourceforge.kolmafia.swingui.CommandDisplayFrame$CommandQueueHandler.handleQueue(CommandDisplayFrame.java:181)
	at net.sourceforge.kolmafia.swingui.CommandDisplayFrame$CommandQueueHandler.run(CommandDisplayFrame.java:155)



=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
         KoLmafia v15.1 r10810, Windows 7, Java 1.7.0_02
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 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: Mon Mar 19 18:58:24 GMT 2012
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


KoLmafia declares world peace.
KoLmafia declares world peace.
KoLmafia declares world peace.
KoLmafia declares world peace.
KoLmafia declares world peace.
KoLmafia declares world peace.
KoLmafia declares world peace.
KoLmafia declares world peace.
KoLmafia declares world peace.
KoLmafia declares world peace.
KoLmafia declares world peace.

> <b>CURRENT</b>: call scripts\dev\bumcheekascend\bumcheekascend.ash
> <b>QUEUED 1</b>: call scripts\dev\bumcheekascend\bumcheekascend.ash
> <b>QUEUED 2</b>: call scripts\dev\bumcheekascend\bumcheekascend.ash
> <b>QUEUED 3</b>: call scripts\dev\bumcheekascend\bumcheekascend.ash

KoLmafia declares world peace.
KoLmafia declares world peace.
KoLmafia declares world peace.
KoLmafia declares world peace.
KoLmafia declares world peace.

> <b>CURRENT</b>: call scripts\dev\bumcheekascend\bumcheekascend.ash
> <b>QUEUED 1</b>: call scripts\dev\bumcheekascend\bumcheekascend.ash
> <b>QUEUED 2</b>: call scripts\dev\bumcheekascend\bumcheekascend.ash
> <b>QUEUED 3</b>: call scripts\dev\bumcheekascend\bumcheekascend.ash
> <b>QUEUED 4</b>: eat fortune cookie

KoLmafia declares world peace.
 

Veracity

Developer
Staff member
What counterScript are you using? We got an NPE trying to compile it:

Code:
class java.lang.NullPointerException: null
java.lang.NullPointerException
	at net.sourceforge.kolmafia.textui.parsetree.Scope.addCommand(Scope.java:77)
	at net.sourceforge.kolmafia.textui.Parser.parseLoopScope(Parser.java:1937)
	at net.sourceforge.kolmafia.textui.Parser.parseWhile(Parser.java:1382)
	at net.sourceforge.kolmafia.textui.Parser.parseCommand(Parser.java:924)
	at net.sourceforge.kolmafia.textui.Parser.parseConditional(Parser.java:1218)
	at net.sourceforge.kolmafia.textui.Parser.parseCommand(Parser.java:948)
	at net.sourceforge.kolmafia.textui.Parser.parseScope(Parser.java:451)
	at net.sourceforge.kolmafia.textui.Parser.parseConditional(Parser.java:1224)
	at net.sourceforge.kolmafia.textui.Parser.parseCommand(Parser.java:948)
	at net.sourceforge.kolmafia.textui.Parser.parseScope(Parser.java:451)
	at net.sourceforge.kolmafia.textui.Parser.parseFunction(Parser.java:719)
	at net.sourceforge.kolmafia.textui.Parser.parseScope(Parser.java:471)
	at net.sourceforge.kolmafia.textui.Parser.parseFunction(Parser.java:719)
	at net.sourceforge.kolmafia.textui.Parser.parseScope(Parser.java:471)
	at net.sourceforge.kolmafia.textui.Parser.parse(Parser.java:189)
	at net.sourceforge.kolmafia.textui.Interpreter.validate(Interpreter.java:252)
	at net.sourceforge.kolmafia.KoLmafiaASH.getInterpreter(KoLmafiaASH.java:203)
	at net.sourceforge.kolmafia.request.GenericRequest.invokeCounterScript(GenericRequest.java:1032)
	at net.sourceforge.kolmafia.request.GenericRequest.stopForCounters(GenericRequest.j
 

Veracity

Developer
Staff member
> validate CC.ash

Unexpected error, debug log printed.
Well, that's easily reproducible. I assume the "random" freezes just happen to correspond to a counter expiring. :)

This is Bale's CounterChecker v1.4, which, of course, is nothing like current. You might want to try upgrading. Which is not to say that we shouldn't figure out the ASH compiler bug.
 

Veracity

Developer
Staff member
I can reproduce this bug with a simple test script. If I "validate" the following script:

Code:
while( true )
    ;
I get:

Code:
class java.lang.NullPointerException: null
java.lang.NullPointerException
	at net.sourceforge.kolmafia.textui.parsetree.Scope.addCommand(Scope.java:77)
	at net.sourceforge.kolmafia.textui.Parser.parseLoopScope(Parser.java:1937)
	at net.sourceforge.kolmafia.textui.Parser.parseWhile(Parser.java:1382)
	at net.sourceforge.kolmafia.textui.Parser.parseCommand(Parser.java:924)
	at net.sourceforge.kolmafia.textui.Parser.parseScope(Parser.java:451)
	at net.sourceforge.kolmafia.textui.Parser.parse(Parser.java:189)
	at net.sourceforge.kolmafia.textui.Interpreter.validate(Interpreter.java:252)
which is the construct and associated error that caused CounterChecker to not compile.
 

Veracity

Developer
Staff member
You know - here is the original function from Bale's script:
Code:
	void eat_cookie() {
		if(get_property("semirareCounter").to_int() != last) {
			// semi-rare acquired, let's do it again
			if(my_fullness() == fullness_limit())
				print("If I ate even a fortune cookie I'd burst! Remember to eat a fortune cookie when the tummy is emptier.", "red");
			else while(toEat())
				eatsilent(1, $item[fortune cookie]);
		} else
			print("Oops, that wasn't the right number!", "red");
	}
and here is what you modified it into:
Code:
	void eat_cookie() {
		if(get_property("semirareCounter").to_int() != last) {
			// semi-rare acquired, let's do it again
			if(my_fullness() == fullness_limit())
				print("If I ate even a fortune cookie I'd burst! Remember to eat a fortune cookie when the tummy is emptier.", "red");
			else while(toEat())
				//eatsilent(1, $item[fortune cookie]);
		} else
			print("Oops, that wasn't the right number!", "red");
	}
In other words, YOU modified the script and revealed this error; people using Bale's script un-munged wouldn't have this problem.

We should still fix the compiler bug, but, I just have to laugh. Ha ha ha!
 

Veracity

Developer
Staff member
Actually, don't bother: I will fix it.

There are three issues:

1) BCC modified Bale's script to have a syntax error and we did not detect it.
2) Instead, we took an empty command and added it to the scope
3) The scope did not do the right thing with the empty command.

I will fix all of them.
 

Veracity

Developer
Staff member
Revision 10817.

BCC will have to fix his modified CounterChecker to not have a syntax error. But, we are nice enough to point it out to him, now, rather than throwing an NPE. :)
 
Top