Here's another bug. I have:
- Relatively fast 2-core computer (core duo 1700 or something)
- Sun Java 1.6.0_05
- Latest batclient
- My plugins from
http://www.helsinki.fi/~tvkankaa/bat-plugins.html- All the .bcs files listed below almost verbatim from the example scripts (except hb.bcs, geteq.bcs, o.bcs which shouldn't matter that much, they are just simple triggermanager.newtriggers).
The bug:
Every now and then I get a ConcurrentModificationException at boot time, like in the example log. Not every time, maybe one in ten, and the place where it happens varies, and sometimes it's only the exception without any debug info.
Possible fix: Thread safe code.
Bonus related interesting feature: You can log into game even if your bootup scripts haven't been completely loaded yet. This might cause interesting problems if you have a trigger which waits for eg. "Entering game." message (or event, I think there was an event) to do something, for example to start logging like I have in BatSuperLogger. If the code is loaded
after you have already logged into game, the trigger will probably never activate.
Example log:
CODE
Reloading scripts started:
Loading script file: cda.bcs
Loading combat
Loaded combat
Loading combat
Loaded combat
Loading script file: combat.bcs
BPF: Loading!
BPF: See "$w help" for command reference and "$w win" to open program window
Loading script file: gag.bcs
Loading script file: geteq.bcs
Loading script file: hb.bcs
Loading script file: lite.bcs
Loading script file: o.bcs
Loading script file: prots.bcs
Loading script file: rounds.bcs
Loading script file: sound.bcs
Loading script file: spellnames.bcs
Loading script file: uncon.bcs
Loading script file: w.bcs
Booting scripts started:
LOADED: lite trigs, edit the file lite.bcs to configure the colours.
lite.bcs ok!
LOADED: prot ('$prots.help' for more info.)
prots ok!
LOADED: rounds ('$rounds.help' for more info.)
rounds ok!
hb ok!
spellnames ok!
uncon ok!
BatSound: crit now plays alert.au
BatSound: tick3s now plays bleep.au
BatSound: tell now plays buzzer.au
Failed executing bootup() on script sound
Sourced file: inline evaluation of: ``bootup();'' : Method Invocation pluginManager.processPlugin :
at Line: 19 : in file: inline evaluation of: ``SCRIPT_NAME = "sound"; SCRIPT_DESC =
"A wrapper for BatSound"; SCRIPT_OFF = fals . . . '' : pluginManager .processPlugin (
"fi.iki.photon.batmud.BatSound" , new String [ ] {
Called from method: bootup : at Line: 1 : in file: inline evaluation of: ``bootup();'' : bootup ( )
Target exception: java.util.ConcurrentModificationException
combat ok!
gag.bcs ok!
cda ok!
Booting scripts finished.
EDIT: Maybe I should add that it is perfectly possible that BatSound or my other plugins break some rules and cause the ConcurrentModificationException. For example, if loadPlugin and processPlugin (called from a script bootup() method) are run in separate threads and happen to run at the same time. Maybe somewhere in the documentation it should say that plugins can be called from whatever concurrent threads and that they should be coded to be safe. I haven't fixed my code yet (to see if it does cause the error) since I haven't had time.