Bug - Fixed Infinite mall search loop

Okay, so on the Purchases tab, if one enters nothing into the "Item to find" input and hits search, KoLMafia gets into an infinite loop. (To be precise, I have the cursor in the input and hit enter.) It is impossible to break the loop by hitting cancel, and logging out of KoL and logging back in does not break the loop either. Only by fully exiting KoLMafia can this be fixed. I've had this happen on both my desktop (Windows XP) and laptop (Windows 7), though I expect that that is completely irrelevant information.

On a sidenote, I have something odd happen on my desktop sometimes in that same input field. If I'm quickly typing something (say, "hi mein" and hit enter right afterward, without a pause, there's a chance that KoLMafia will clear my input and do the favorite store search. (And consequently, recently, enter that infinite loop.) I've not been able to get it to do that on my laptop, though, so it may not be easy to reproduce.
 

Veracity

Developer
Staff member
You didn't wait for it to finish, did you? I don't blame you, but this is actually NOT an "infinite loop".

If you go the mall in the Relay Browser and hit "return", it will search for every item in the mall and display them 10 per page.
The first page says "Search Results: (Items 1-10 of 3625)".
In other words, 363 pages worth of items.
Doing the same thing on the purchase tab, we get them all, now.

I don't know why it claims to be "Looking up favorite stores list". Is that what it is SUPPOSED to do when you search for an empty item?

Edit: I waited for it to fetch all 363 pages and it said "Search complete", but did not display a list of 36250 items. Pooh. Perhaps that was too big for Swing?

So, what IS the bug, here? I see several possibilities.

- Don't do 363 page loads.
- If you DO do 363 page loads, at least show the results.
- If you search for nothing, get the favorite stores list, rather than the list of all items.
- Something else?
 
Last edited:

lostcalpolydude

Developer
Staff member
Searching for 'a' returns over 2000 items, so a check for no search term probably isn't sufficient. Searching for 'tiny plastic' returns 123 items, which is probably the largest group that someone actually wants to see on one screen, but that number will go up. I could see something where if the number of items is larger than 200 then mafia just returns the first page of results. Maybe there could be special handling for an empty search string also.

On the other hand, doing a test search for 'y' (about 1100 items) created a data override for 'creepy voodoo doll'.
 

Winterbay

Active member
Or you could add a box wherein you can enter the maximum amount of hits that you are wanting to see?
 
I don't think that it's doing what you're saying, hopefully this picture will illustrate it better:

infinitemall.png


If you see, this isn't showing one of every item, but a selection of items from my favorite stores list. It used to do one such search and be done at that, but now it does the same search over and over and over and over, and creates the same duplicates each time.

I'm letting it run now *just* to check to make sure that it's not fetching a limited number of times, but even if it is, does that explain why hitting cancel doesn't work? Or why logging out doesn't stop it? Or, most importantly, why it's duplicating the same results over and over and over?

Edit: Oh, and I am using the latest daily build, to clarify.

Update: It did hit a "search complete" state, you're right. However, it's still most certainly a bug, as it's showing the same results over and over that it got in the first search. And the cancel button not working.
 
Last edited:

Veracity

Developer
Staff member
It is explicitly coded to search favorite stores if you have an empty mall search string.

I added a couple of favorite stores for one of my multis and did such a search. It showed me the contents of my various favorite stores.

Revision 9240 makes mall searches only iterate if you are looking for items. It also makes it detect if there will be multiple page loads of search and give you a progress report. Thus:

Searching for alice's army...
Searching for alice's army (2 of 5)...
Searching for alice's army (3 of 5)...
Searching for alice's army (4 of 5)...
Searching for alice's army (5 of 5)...
Search complete.

If you search for "a", it will do 268 page loads. I wonder if I should stick in a "are you sure?" dialog if, after page 1, we see it will do more than, say, 10 page loads?
 
Revision 9240 makes mall searches only iterate if you are looking for items. It also makes it detect if there will be multiple page loads of search and give you a progress report.

Yay! The cancel button still seems to do nothing, but that's still a major improvement.

If you search for "a", it will do 268 page loads. I wonder if I should stick in a "are you sure?" dialog if, after page 1, we see it will do more than, say, 10 page loads?

That sounds like a good idea. Probably want some option to disable that for people who don't want confirmation, obviously, but that's something that'd be useful.
 

Veracity

Developer
Staff member
Revision 9242 stops the search if you hit ESC and force World Peace. (Which is the same thing that the Cancel button on the Adventure Frame and the Stop Everything menu item do). That's probably good enough; rather than saying "this will take 200 page loads. Are you sure?" the user can always hit Escape if it turns out to be more than she expected.
 
(Which is the same thing that the Cancel button on the Adventure Frame and the Stop Everything menu item do).

The ESC key, stop everything menu item, and Stop Now button on the Adventure tab all work. The cancel button on the Purchases tab does not work.

And yeah, it'll probably be good enough, once that button starts behaving and stops things.

Edit: I just realized why it's probably not working, the error message given is the same as when it's the purchase button. The code probably doesn't check to see if it's a purchase or cancel button.

Update: So, it looks like a revision today made the cancel button work as it should (aside from for favorite store searches.) *almost* there, but could you guys look again? If you do a blank search and have favorite stores, then quickly hit cancel, the search isn't actually stopped. It's not major at all, but it does mean that something isn't working as intended.
 
Last edited:

Veracity

Developer
Staff member
What cancel button?

Ah. When you start a search, "purchase" turns into "cancel".

Huh. I never noticed that.
 

Raven434

Member
Sorry for the thread necromancy, but I am still seeing this behavior in the most recent builds.

Meaming, I just get a list if my mall favorite stores and the item I search for is never serached for.

Thanks.

Update - even after deleting my mall favorites, all the search does is produce 0 results while parroting "Looking up favorite stores list..."
 
Last edited:

lostcalpolydude

Developer
Staff member
Sorry for the thread necromancy, but I am still seeing this behavior in the most recent builds.

Meaning, I just get a list if my mall favorite stores and the item I search for is never searched for.

Thanks.

Update - even after deleting my mall favorites, all the search does is produce 0 results while parroting "Looking up favorite stores list..."

You got that when typing in an item in the Item to Find field? If so, that isn't related to this bug report, and it isn't happening for me.
 
Top