Bug - Fixed Unreasonably complex expression for expert panhandling

roippi

Developer
Yeah, you've got a bad demon name somewhere in your preferences that's messing up your daily deeds panel.
 

arbarbonif

New member
Unreasonably complex expression for expert panhandling: java.lang.ArrayIndexOutOfBoundsException: -1
Unreasonably complex expression for expert panhandling: java.lang.ArrayIndexOutOfBoundsException: -1

Which is interesting.

I added in a stacktrace and it is happening on the last line of evalInternal. I corrected these stacktraces for the 4 lines I added to eval to catch the stacktrace and the 2 imports that were added. (So in my version evalInternal was on 211, eval was on 94) And after those changes I got -1 and -2...

at net.sourceforge.kolmafia.Expression.evalInternal(Expression.java:205)
at net.sourceforge.kolmafia.Expression.eval(Expression.java:92)
at net.sourceforge.kolmafia.Modifiers.override(Modifiers.java:1726)
at net.sourceforge.kolmafia.Modifiers.getModifiers(Modifiers.java:1583)
at net.sourceforge.kolmafia.Modifiers.applyPassiveModifiers(Modifiers.java:1943)
at net.sourceforge.kolmafia.KoLCharacter.recalculateAdjustments(KoLCharacter.java:4055)
at net.sourceforge.kolmafia.KoLCharacter.recalculateAdjustments(KoLCharacter.java:3850)
at net.sourceforge.kolmafia.KoLCharacter.recalculateAdjustments(KoLCharacter.java:3845)
at net.sourceforge.kolmafia.request.GenericRequest.run(GenericRequest.java:1201)
at net.sourceforge.kolmafia.request.RelayRequest.run(RelayRequest.java:1906)
at net.sourceforge.kolmafia.request.CharPaneRequest.run(CharPaneRequest.java:121)
at net.sourceforge.kolmafia.webui.RelayAgent.readServerResponse(RelayAgent.java:378)
at net.sourceforge.kolmafia.webui.RelayAgent.performRelay(RelayAgent.java:150)
at net.sourceforge.kolmafia.webui.RelayAgent.run(RelayAgent.java:127)
java.lang.ArrayIndexOutOfBoundsException: -2
at net.sourceforge.kolmafia.Expression.evalInternal(Expression.java:205)
at net.sourceforge.kolmafia.Expression.eval(Expression.java:92)
at net.sourceforge.kolmafia.Modifiers.override(Modifiers.java:1726)
at net.sourceforge.kolmafia.Modifiers.getModifiers(Modifiers.java:1583)
at net.sourceforge.kolmafia.Modifiers.applyPassiveModifiers(Modifiers.java:1943)
at net.sourceforge.kolmafia.KoLCharacter.recalculateAdjustments(KoLCharacter.java:4055)
at net.sourceforge.kolmafia.KoLCharacter.recalculateAdjustments(KoLCharacter.java:3850)
at net.sourceforge.kolmafia.KoLCharacter.recalculateAdjustments(KoLCharacter.java:3845)
at net.sourceforge.kolmafia.request.GenericRequest.run(GenericRequest.java:1201)
at net.sourceforge.kolmafia.request.RelayRequest.run(RelayRequest.java:1906)
at net.sourceforge.kolmafia.request.CharPaneRequest.run(CharPaneRequest.java:121)
at net.sourceforge.kolmafia.webui.RelayAgent.readServerResponse(RelayAgent.java:378)
at net.sourceforge.kolmafia.webui.RelayAgent.performRelay(RelayAgent.java:150)
at net.sourceforge.kolmafia.webui.RelayAgent.run(RelayAgent.java:127)
 
Last edited:

arbarbonif

New member
New stacktrace. Also had an error from

at net.sourceforge.kolmafia.ModifierExpression.evalBytecode(ModifierExpression.java:113)
at net.sourceforge.kolmafia.Expression.evalInternal(Expression.java:202)
at net.sourceforge.kolmafia.Expression.eval(Expression.java:92)
at net.sourceforge.kolmafia.Modifiers.override(Modifiers.java:1726)
at net.sourceforge.kolmafia.Modifiers.getModifiers(Modifiers.java:1583)
at net.sourceforge.kolmafia.Modifiers.applyPassiveModifiers(Modifiers.java:1943)
at net.sourceforge.kolmafia.KoLCharacter.recalculateAdjustments(KoLCharacter.java:4055)
at net.sourceforge.kolmafia.KoLCharacter.recalculateAdjustments(KoLCharacter.java:3850)
at net.sourceforge.kolmafia.KoLCharacter.recalculateAdjustments(KoLCharacter.java:3845)
at net.sourceforge.kolmafia.request.GenericRequest.run(GenericRequest.java:1201)
at net.sourceforge.kolmafia.request.RelayRequest.run(RelayRequest.java:1906)
at net.sourceforge.kolmafia.request.CharPaneRequest.run(CharPaneRequest.java:121)
at net.sourceforge.kolmafia.webui.RelayAgent.readServerResponse(RelayAgent.java:378)
at net.sourceforge.kolmafia.webui.RelayAgent.performRelay(RelayAgent.java:150)
at net.sourceforge.kolmafia.webui.RelayAgent.run(RelayAgent.java:127)
 

jasonharper

Developer
arbarbonif, what was the actual exception message for your 2nd stacktrace? And do you recall what weapon you were wielding at the time?
 

arbarbonif

New member
java.lang.ArrayIndexOutOfBoundsException: -1

I was wielding a Staff of the Walk-in Freezer and a Bag of Tricks. I was spell slinging undead sorority chicks.

All the Exceptions I've see have been either -1 or -2, so it is odd that increasing the array size lowers the incidence.
 

jasonharper

Developer
I'm still not seeing the actual cause of this problem, so r9936 adds more lines of debugging output - starting with "Bytecode:" and extending through the "Unreasonably..." message itself.

What I need to see now is that block of lines, ideally from the very first instance of the problem in a mafia session.
 

GadTheHero

New member
Okay, this happened on my 5th turn today, using r9937

"[2808] The Haunted Sorority House
Encounter: Mitzi Costington, the Sexy Herpetologist Werewolf
Round 0: gadthehero wins initiative!
Round 0: gadthehero casts SPRING RAINDROP ATTACK!
You gain 37 hit points
You gain 32 Muscularity Points
You lose 39 hit points
Round 1: gadthehero attacks!
Round 2: gadthehero wins the fight!
You gain 121 Muscleboundness
You gain a Muscle point!
You gain 43 Enchantedness
You gain 48 Roguishness
Bytecode: 耀h者*耊+r 8000 68 8005 2a 800a 2b 72
Stack: 10.0 10.0 10.0 0.0 0.0 0.0 0.0 0.0
net.sourceforge.kolmafia.Expression.evalInternal(Expression.java:147)
Unreasonably complex expression for expert panhandling: java.lang.ArrayIndexOutOfBoundsException: -1"
 

jasonharper

Developer
Yeah, integer constants in the bytecode are offset by 0x8000, which puts them right in the middle of the Chinese/Japanese/Korean ideographic section of Unicode. "glory" to "those who" do "<unknown>"? Maybe this is telling me exactly how to fix the problem, but I can't find a definition of that 3rd glyph anywhere.

This is making no sense at all. The bytecode is perfectly valid, and needs 2 stack levels to evaluate. So how is the stack pointer both going one too high (resulting in 3 values on the stack) and one too low (resulting in the exception)? It's like we've suddenly started using discount integers that are only guaranteed to ±1 accuracy.
 
According to google translate, the third symbol is Chinese for "die".

"Glory to those who die."

How amusing and epic (in a "characters are written to say things like this just before the big battle" sense).
 

xKiv

Active member
According to google translate, the third symbol is Chinese for "die".

"Glory to those who die."

According to pages that are slightly more authoritathive as dictionaries, it's just *pronounced* die / dié / die2 (depending on your transciption system) and doesn't have any common associated meaning.
Sino-japanese pronounciation is "tetsu" (which *might* mean "iron").
No words containing this character found.
"Not a general use character"
"Not one of the 2500 most used kanji in newspapers" (which explains why it isn't in my ~2200 kanji dictionary)
It doesn't seem to have unicode character name.
It's not in Jim Breen's WWWJDIC.
 
Well, if anime will teach us anything, it's that sometimes Asians are willing to intentionally use engrish, and will write it out phonetically as best as they can. So, yeah, totally "die". It's a lot cooler that way, too.
 

jasonharper

Developer
r9949 may fix the problem, but keep in mind that I've never managed to duplicate the problem myself, and none of the extra debug info I've added has given any definitive evidence of what the root cause was. There were definitely some thread-safety issues with the code, so I'm just going to assume that they were responsible for everything.
 

xKiv

Active member
Well, if anime will teach us anything, it's that sometimes Asians are willing to intentionally use engrish, and will write it out phonetically as best as they can. So, yeah, totally "die". It's a lot cooler that way, too.

Except phonetical transcription of the english word "die" would be closer to "daai". As it is, it's probably pronounced more like some form of the latin words for god or day (at least in the variant of modern latin pronounciation with which I am familiar).
That's not even going into why they would go to the trouble of creating a completely new character (with newly invented pronounciation) for a phonetic transcription of a word they already have, and are willing to write out in latin characters. Nobody would know how to read it.
 
Top