Forum: PogamutUT2004

Exceptions generated when bots start at same or near same time

Don't know if this is an error from my side or just something that can't be avoided. What happens is I get following error:

Exception in thread "Thread-1" com.google.inject.ProvisionException: Guice provision errors:

This happens if I create two bots just after each other. If I wait around 1500 milli seconds this error wont show up. Though the error pops up it looks like everything runs fine afterword.

I'm just waiting the 1500 milli seconds before I'm starting each bot so the error wont show up but just wanted to give a head up as I don't know if it an error or working as intended?
Hi! This is definetly a bug. Thanks for reporting.

Please - can you post some piece of code where you're starting all bots? (Functional as well as buggy version.)
What class are you using to fire up the bot?

Thanks,
Jimmy
Its very simple to recreate. I start two thread (or more) after each other with the following in their run() method:

int serverPort = BotSetup.INSTANCE.getDummyServerPort();

UT2004BotModule myModule = new UT2004BotModule(DummyBot.class);
UT2004BotFactory factory = new UT2004BotFactory(myModule);

UT2004BotRunner botRunner = new UT2004BotRunner(factory, "DummyBot", "localhost", serverPort);
IAgent agent = botRunner.startAgent();

// wait until the bot finishes and close Pogamut platform
new WaitForAgentStateChange(agent.getState(), IAgentStateStopped.class).await();
Pogamut.getPlatform().close();


If I want it to run functional I just make 1500 miliseconds pass before starting the next thread. Found out with 1000 milli seconds it would still generate bug some times.
Wow - so it points more to Guice than Pogamut :-( ... you could probably use direct factory than Guice one. I will write details later (direct factory will
create you bot manually instead of constructing the Guice injector).

Best,
Jimmy