Bug - Not A Bug Chateau MP restore infinite loop.

VladYvhuce

Member
I've noticed a problem with the past several versions of Mafia. When I click on the MP bar in the relay browser, instead of just restoring my MP like it used to, Mafia enters an infinite loop that tries to eat all of my adventures, so I have to hit the "Stop Now" button. Here's the CLI output from tonight, using version 17933:
> restore mp

Restoring MP! Currently at 2214 of 2214 HP, 10 of 1165 MP, current meat: 28860039 ... Target MP = 1165.

[6403] Rest in your bed in the Chateau
You gain 147 Muscularity Points
You acquire an item: Choco-Mint patty
You gain 160 Sarcasm

[6403] Rest in your bed in the Chateau
You gain 127 Muscularity Points
You gain 160 Sarcasm

[6403] Rest in your bed in the Chateau
You gain 123 Muscularity Points
You acquire an item: hot mint schnocolate
You gain 160 Roguishness

[6403] Rest in your bed in the Chateau
You gain 131 Muscularity Points
You gain 160 Roguishness

[6403] Rest in your bed in the Chateau
You gain 101 Muscularity Points
You acquire an item: hot mint schnocolate
You gain 160 Roguishness

[6403] Rest in your bed in the Chateau
You gain 125 Muscularity Points
You gain 160 Sarcasm
You gain a Moxie point!

[6403] Rest in your bed in the Chateau
You gain 102 Muscularity Points
You gain 160 Roguishness

[6403] Rest in your bed in the Chateau
You gain 122 Muscularity Points
You acquire an item: homeopathic mint tea
You gain 160 Roguishness

[6403] Rest in your bed in the Chateau
You gain 160 Chutzpah

[6403] Rest in your bed in the Chateau
You gain 160 Smarm

[6403] Rest in your bed in the Chateau
You gain 160 Chutzpah

[6403] Rest in your bed in the Chateau
You gain 160 Cheek
You gain a Moxie point!

[6403] Rest in your bed in the Chateau
You gain 160 Sarcasm

[6403] Rest in your bed in the Chateau
You gain 160 Cheek

[6403] Rest in your bed in the Chateau
You gain 160 Roguishness

[6403] Rest in your bed in the Chateau
You acquire an item: homeopathic mint tea
You gain 160 Smarm

[6403] Rest in your bed in the Chateau
You gain 160 Smarm

[6403] Rest in your bed in the Chateau
You gain 160 Sarcasm
You gain a Moxie point!

[6403] Rest in your bed in the Chateau
You acquire an item: Choco-Mint patty
You gain 160 Sarcasm

[6403] Rest in your bed in the Chateau
You gain 160 Smarm

[6403] Rest in your bed in the Chateau
You gain 160 Roguishness

[6403] Rest in your bed in the Chateau
You gain 160 Chutzpah

[6403] Rest in your bed in the Chateau
You gain 160 Sarcasm

[6403] Rest in your bed in the Chateau
You gain 160 Cheek
You gain a Moxie point!

[6403] Rest in your bed in the Chateau
You gain 160 Chutzpah

[6403] Rest in your bed in the Chateau
You gain 160 Roguishness

[6403] Rest in your bed in the Chateau
You gain 160 Chutzpah

[6403] Rest in your bed in the Chateau
You gain 160 Sarcasm

[6403] Rest in your bed in the Chateau
You gain 160 Chutzpah

[6403] Rest in your bed in the Chateau
You gain 160 Smarm
You gain a Moxie point!

[6403] Rest in your bed in the Chateau
You gain 160 Cheek

[6403] Rest in your bed in the Chateau
You gain 160 Roguishness

[6403] Rest in your bed in the Chateau
You gain 160 Chutzpah

[6403] Rest in your bed in the Chateau
You gain 160 Sarcasm

[6403] Rest in your bed in the Chateau
You gain 160 Cheek

[6403] Rest in your bed in the Chateau
You gain 160 Sarcasm
You gain a Moxie point!

[6403] Rest in your bed in the Chateau
You gain 160 Sarcasm

[6403] Rest in your bed in the Chateau
You gain 160 Chutzpah

[6403] Rest in your bed in the Chateau
You gain 160 Roguishness

[6403] Rest in your bed in the Chateau
You gain 160 Chutzpah

[6403] Rest in your bed in the Chateau
You gain 160 Roguishness

[6403] Rest in your bed in the Chateau
You gain 160 Chutzpah
You gain a Moxie point!

[6403] Rest in your bed in the Chateau
You acquire an item: homeopathic mint tea
You gain 160 Roguishness

[6403] Rest in your bed in the Chateau
You gain 160 Smarm

[6403] Rest in your bed in the Chateau
You gain 160 Roguishness

[6403] Rest in your bed in the Chateau
You gain 160 Chutzpah

[6403] Rest in your bed in the Chateau
You gain 160 Chutzpah

[6403] Rest in your bed in the Chateau
You acquire an item: Choco-Mint patty
You gain 160 Cheek
You gain a Moxie point!

[6403] Rest in your bed in the Chateau
You gain 160 Sarcasm

[6403] Rest in your bed in the Chateau
You gain 160 Sarcasm

[6403] Rest in your bed in the Chateau
You gain 160 Smarm

[6403] Rest in your bed in the Chateau
You gain 160 Cheek

[6403] Rest in your bed in the Chateau
You gain 160 Cheek

[6403] Rest in your bed in the Chateau
You gain 110 Sarcasm
You gain a Moxie point!

[6403] Rest in your bed in the Chateau
You gain 111 Chutzpah

[6403] Rest in your bed in the Chateau
You gain 111 Sarcasm

[6403] Rest in your bed in the Chateau
You gain 110 Chutzpah

[6403] Rest in your bed in the Chateau
You gain 110 Sarcasm

[6403] Rest in your bed in the Chateau
You gain 111 Cheek

[6403] Rest in your bed in the Chateau
KoLmafia declares world peace.
You gain 110 Smarm
 

Bale

Minion
What that shows is that mafia believes it was not using adventures to rest since they were all on turn 6403. Obviously that is wrong since there's no way you could have had that many free rests. Another mistake is that mafia is not showing a gain of MP for rests after the eighth. Which is just weird.

Since mafia thinks it is still using free rests while not gaining MP, there isn't any reason for it to stop resting.

You say it was from last night which I'm guessing was April 2nd. Could you possibly be wrong and it was actually from April 1st? Because bad parsing caused by salad is the only answer of which I can think. Has this actually happened many times?
 

lostcalpolydude

Developer
Staff member
Somehow mafia wasn't parsing api.php, which I expect was not saladified. I doubt anything can be done with this report unless it can be reproduced.
 

VladYvhuce

Member
What that shows is that mafia believes it was not using adventures to rest since they were all on turn 6403. Obviously that is wrong since there's no way you could have had that many free rests. Another mistake is that mafia is not showing a gain of MP for rests after the eighth. Which is just weird.

Since mafia thinks it is still using free rests while not gaining MP, there isn't any reason for it to stop resting.

You say it was from last night which I'm guessing was April 2nd. Could you possibly be wrong and it was actually from April 1st? Because bad parsing caused by salad is the only answer of which I can think. Has this actually happened many times?
It happened before April 1st, and has happened every time I try to do it since. I hadn't changed any settings before it started, so it's s mystery to me as to what happened to get broken...

Here's a CLI output from a few minutes ago when I just tried it again with r17938.
> restore mp

Restoring MP! Currently at 953 of 953 HP, 241 of 473 MP, current meat: 26671880 ... Target MP = 473.

[6753] Rest in your bed in the Chateau
You gain 122 Muscularity Points
You acquire an item: homeopathic mint tea
You gain 111 Smarm

[6753] Rest in your bed in the Chateau
You gain 96 Muscularity Points
You gain 111 Sarcasm

[6753] Rest in your bed in the Chateau
You gain 111 Smarm

[6753] Rest in your bed in the Chateau
You gain 110 Smarm

[6753] Rest in your bed in the Chateau
You acquire an item: Choco-Mint patty
You gain 111 Smarm

[6753] Rest in your bed in the Chateau
You gain 111 Sarcasm
You gain a Moxie point!

[6753] Rest in your bed in the Chateau
You gain 111 Smarm

[6753] Rest in your bed in the Chateau
You gain 111 Roguishness

[6753] Rest in your bed in the Chateau
You gain 111 Smarm

[6753] Rest in your bed in the Chateau
You gain 110 Chutzpah

[6753] Rest in your bed in the Chateau
You gain 111 Sarcasm

[6753] Rest in your bed in the Chateau
You gain 111 Roguishness

[6753] Rest in your bed in the Chateau
You gain 110 Chutzpah

[6753] Rest in your bed in the Chateau
You gain 110 Smarm

[6753] Rest in your bed in the Chateau
You gain 111 Roguishness
You gain a Moxie point!

[6753] Rest in your bed in the Chateau
You gain 111 Roguishness

[6753] Rest in your bed in the Chateau
You gain 110 Smarm

[6753] Rest in your bed in the Chateau
You gain 110 Chutzpah

[6753] Rest in your bed in the Chateau
You gain 111 Chutzpah

[6753] Rest in your bed in the Chateau
You acquire an item: Choco-Mint patty
You gain 111 Roguishness

[6753] Rest in your bed in the Chateau
You gain 110 Cheek

[6753] Rest in your bed in the Chateau
You gain 111 Roguishness

[6753] Rest in your bed in the Chateau
You gain 111 Cheek

[6753] Rest in your bed in the Chateau
You gain 111 Chutzpah
You gain a Moxie point!

[6753] Rest in your bed in the Chateau
You gain 110 Smarm

[6753] Rest in your bed in the Chateau
You gain 110 Chutzpah

[6753] Rest in your bed in the Chateau
You gain 111 Sarcasm

[6753] Rest in your bed in the Chateau
You gain 110 Sarcasm

[6753] Rest in your bed in the Chateau
You gain 111 Chutzpah

[6753] Rest in your bed in the Chateau
You gain 110 Chutzpah

[6753] Rest in your bed in the Chateau
You gain 111 Cheek

[6753] Rest in your bed in the Chateau
KoLmafia declares world peace.
You gain 110 Chutzpah
 

Veracity

Developer
Staff member
I extracted this sequence:

Code:
Requesting: https://www.kingdomofloathing.com/charpane.php
Retrieved: https://www.kingdomofloathing.com/charpane.php
MP 219/473
...
GET /KoLmafia/sideCommand?cmd=restore+mp&pwd=xxxx HTTP/1.1
> restore mp
Starting recovery script: Universal_recovery.ash
Requesting: http://zachbardon.com/mafiatools/autoupdate.php?f=recoveryScript_map_v2&act=getver
Retrieved: http://zachbardon.com/mafiatools/autoupdate.php?f=recoveryScript_map_v2&act=getver
<font color="#33CCCC">Restoring MP! Currently at 953 of 953 HP, 219 of 473 MP, current meat: 26671880 ... Target MP = 473.</font>
---
[6785] Rest in your bed in the Chateau
Connecting to place.php...
Requesting: https://www.kingdomofloathing.com/place.php?whichplace=chateau&action=chateau_restbox
Retrieved: https://www.kingdomofloathing.com/place.php?whichplace=chateau&action=chateau_restbox
Parsing result: You gain 137 Muscularity Points
You gain 137 Muscularity Points
Processing result:  MP: 137
Parsing result: You gain 111 Sarcasm
You gain 111 Sarcasm
Processing result:  Substats: 0 / 0 / 111
You gain a Moxie point!
---
[6785] Rest in your bed in the Chateau
Connecting to place.php...
Requesting: https://www.kingdomofloathing.com/place.php?whichplace=chateau&action=chateau_restbox
Retrieved: https://www.kingdomofloathing.com/place.php?whichplace=chateau&action=chateau_restbox
Parsing result: You gain 101 Muscularity Points
You gain 101 Muscularity Points
Processing result:  MP: 101
Parsing result: You gain 110 Smarm
You gain 110 Smarm
Processing result:  Substats: 0 / 0 / 110
---
[6785] Rest in your bed in the Chateau
Connecting to place.php...
Requesting: https://www.kingdomofloathing.com/place.php?whichplace=chateau&action=chateau_restbox
Retrieved: https://www.kingdomofloathing.com/place.php?whichplace=chateau&action=chateau_restbox
Parsing result: You gain 111 Smarm
You gain 111 Smarm
Processing result:  Substats: 0 / 0 / 111
---
You clicked on the sidebar and it asked for "recover mp"
You are running Universal Recovery. It would have been nice if you mentioned that.
--> That tells us that every single request to rest in chateau was issued by the script.

Universal recovery first says:

Restoring MP! Currently at 953 of 953 HP, 219 of 473 MP, current meat: 26671880 ... Target MP = 473.

That status - 219/473 - agrees with what the charpane said.

Universal Recovery asked to rest at the chateau.

Parsing result: You gain 137 Muscularity Points
You gain 137 Muscularity Points
Processing result: MP: 137

We are now at 356/419 MP

Universal Recovery asked to rest at the chateau.

Parsing result: You gain 101 Muscularity Points
You gain 101 Muscularity Points
Processing result: MP: 101
We are now at 457/419. Well, obviously, it pegs at 419.

Universal Recovery asked to rest at the chateau.

Parsing result: You gain 111 Smarm
You gain 111 Smarm

No more MP recovery, since you are at full.

Universal Recovery asked to rest at the chateau.
ad infinitum.

From what I can tell, this is not a KoLmafia bug. The "MP restore infinite loop" occurs because Universal Recovery is repeatedly asking to restore MP when MP is at full.

I'm going to mark this Not a Bug.

I'll reopen it if Bale can explain what KoLmafia did wrong. I'm not seeing anything.
 

Veracity

Developer
Staff member
We only increase turncount when we look at charpane.php or api.php.
That never happened between the successive chateau rests.
 

VladYvhuce

Member
You clicked on the sidebar and it asked for "recover mp"
You are running Universal Recovery. It would have been nice if you mentioned that.
--> That tells us that every single request to rest in chateau was issued by the script.
Well, now I know that that's a Universal Recovery function, and not just a Mafia function. I've had Universal Recovery running so long, that I'd forgotten that that wasn't a regular Mafia function... Sorry 'bout that mix-up.
 

Veracity

Developer
Staff member
We only increase turncount when we look at charpane.php or api.php.
That never happened between the successive chateau rests.
And here is why. GenericRequest.processResponse:

Code:
		// Don't bother refreshing status if we are refreshing the
		// session, since none of the requests made while that is
		// happening change anything, even though KoL asks for a
		// charpane refresh for many of them.

		if ( this.responseText.contains( "charpane.php" ) && !KoLmafia.isRefreshing() )
		{
			ApiRequest.updateStatus( true );
			RelayServer.updateStatus();
		}
We say "none of the requests change anything" because we detect changes to HP or MP and update those fields directly, rather than having to take them from api.php.

I guess it never occurred to me that turn count could change since I never "refresh" using turns.

Regardless, it's been this way for quite a while; it was not a recent change to KoLmafia.
 

VladYvhuce

Member
Perhaps it was a recent change to Universal Recovery, then? I tried again, without UR active and got this from the CLI:
> restore mp

[7017] Rest in your bed in the Chateau
You gain 119 Muscularity Points
You gain 111 Roguishness

[7017] Rest in your bed in the Chateau
You gain 124 Muscularity Points
You gain 111 Cheek

[7017] Rest in your bed in the Chateau
You gain 125 Muscularity Points
You gain 111 Roguishness

[7017] Rest in your bed in the Chateau
You gain 109 Muscularity Points
You gain 110 Chutzpah

[7017] Rest in your bed in the Chateau
You gain 104 Muscularity Points
You gain 110 Roguishness

[7017] Rest in your bed in the Chateau
You gain 123 Muscularity Points
You gain 110 Sarcasm

[7017] Rest in your bed in the Chateau
You gain 83 Muscularity Points
You gain 111 Chutzpah

[7017] Rest in your bed in the Chateau
You gain 110 Sarcasm
You gain a Moxie point!

[7017] Rest in your dwelling
Autorecovery failed.
 

Bale

Minion
Just for the record I have never seen this problem. I'm going to take a guess that you have UR set to recover MP even if resting is not free? That would at least explain why there could be a bug like this which I've never encountered. (Personally I recommend NEVER to do that because having UR automatically use your adventures seems dumb, but that dumb thing can be necessary for characters with very few ascensions.) That narrows the possible point of failure to one line which clearly says to only rest if my_mp() < my_maxmp().

I'm going to need you to turn up the verbosity to max in hopes it tells me something I don't know.
 

VladYvhuce

Member
OK... Reinstated UR as my recovery script. And:

Hmm... Now that I've ascended, it won't loop. It now just restores the MP and stops, like it should. Perhaps the problem's got something to do with aftercore?

As to why I've been letting it use adventures to restore HP/MP: they're going to get used manually, anyway for the same purpose. I burn through a lot of MP during most runs, and am too cheap to buy proper amounts of MP restorers... I'm not a speed-ascender, so adventures aren't that "untouchable resource" that others may fear burning through. After all, I've still got familiars to collect...
 

VladYvhuce

Member
Do you have "rest at campground" (whatever the option is) checked?
Yes, in both UR and in KOL's HP/MP usage settings. I was going to try to do some screenshots of my KOL and UR settings, but I can't get the file sizes down low enough for the forum limits.
 

Bale

Minion
To post settings you can do something like the command ashq foreach prop in get_all_properties("baleUR", false) print(prop+ " = " + get_property(prop)); Then copy/paste the response here.

I can't get the file sizes down low enough for the forum limits.

I always use http://imgur.com/ as a good free place to put my images. Then you put the link here, inside of [img] [/img] tags.
 

VladYvhuce

Member
Ah. I tend to use Photobucket. Hope that won't be a problem.
UR settings:
restore2_zpsoolpvx8r.jpg


Mafia restore settings:
Restore1_zpsoki8ggcm.jpg
 
Top