Bug - Fixed Changing Choice Adventure Setting Freezes Mafia

roippi

Developer
I took a look at this a while ago and came up empty. The offending item is ChoiceOptionsPanel.OceanDestinationComboBox and its associated listeners. It's particularly gnarly to debug due to the livelock.
 

Veracity

Developer
Staff member
I suspect it is because that combo box changes one of its entries on the fly; when you say "choose destination...", it prompts you for where to go, and it saves that custom destination in a "go to xxx,yyy" entry. So, you select the entry, which fires the action listener, which pops up a dialog and then rebuilds the menu - all while the action listener is still active.

This has never failed for me with the Java shipped with OS X, but, apparently other Java versions aren't quite so robust.

Feel free to figure out another way to do it that has the same net effect and doesn't fail on some Javas. :)
 

Veracity

Developer
Staff member
OK. Try revision 9835. This will force the popup menu of the combo box to close before presenting the dialog to choose a destination.

I have no idea if that will make things better for those of you who saw this issue. Try it and report back.
 
This has never failed for me with the Java shipped with OS X, but, apparently other Java versions aren't quite so robust.

Feel free to figure out another way to do it that has the same net effect and doesn't fail on some Javas. :)
Unfortunately....
Code:
> uname -a
Darwin Noir.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386
> java -version
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03-384-10M3425)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-384, mixed mode)
As far as I know, that is the most up-to-date version.

r9835 still hard freezes.
 

Veracity

Developer
Staff member
Code:
bash-3.2$ uname -a
Darwin cthulhu.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386
bash-3.2$ java -version
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03-384-10M3425)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-384, mixed mode)
It works perfectly for me.

I throw up my hands. I have no clue why it doesn't work for you.
 

Bale

Minion
I really wish you could reproduce it. I've started a debug log and replicated the problem, but all it says before freezing is


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
KoLmafia v15.0 r10290, Windows XP, Java 1.6.0_26
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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 Jan 23 21:59:03 EST 2012
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

I get this with nearly 100% reliability following the steps in post #11.
 

Veracity

Developer
Staff member
I tried and tried and tried and failed to replicate the issue.

Try revision 10291, which uses my current knowledge of Swing and listeners to simplify the code for that Combo Box. Maybe it will magically work for you.
 

Bale

Minion
Sadly, this did not fix the bug. Your inability to replicate the bug must have something to do with me using Windows and you using a Mac.

No other choice adventure causes this problem! Is the code for this adventure really that different?

Perhaps you could put in lines that would print out something to the debug log if I turned on debug logging? With some debug statements we could at least home in on where the problem occurs...
 

Veracity

Developer
Staff member
No other choice adventure causes this problem! Is the code for this adventure really that different?
It is a custom combo box that adds a new menu item when you select the "choose destination" menu item. About the only other difference I can see is that it sets the selected index in the combo box from the preference when it creates the combo box, rather than later after it has actually been installed in the frame.

Revision 10294 defers loading the preference and selecting the menu item until after the frame is constructed and every other preference is also loading preferences and setting selected index. If this doesn't work, I have no idea where to go from here.
 

roippi

Developer
I used to be able to replicate this (Win 7) and no longer can in the current revision. Fixed for me.
 

Veracity

Developer
Staff member
I did some google-ation on JComboBox ActionEvent callbacks and Swing freezes. I gleaned that doing "too much" in callback is a Bad Thing. In the OceanDestinationComboBox, we are saving a couple of properties. That does disk I/O. I suspect that, on your system, that is "too much".

Revision 10301 moves all the property setting out of the Action callback. The one place where it seemed unavoidable is now done in a separate Thread.

It works, same as always, for me. Tell me how it works for you.
 

Bale

Minion
It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed! It's fixed!
 
Last edited:
Top