gama-platform / gama.old

Main repository for developing the 1.x versions of GAMA
GNU General Public License v3.0
304 stars 99 forks source link

Exception when 2 headless simulations send message to MQTT broker #3356

Closed benoitgaudou closed 2 years ago

benoitgaudou commented 2 years ago

Describe the bug Let's consider a model sending a message to an ActiveMQ broker. When launched on GAMA GUI, it works (as expected). When launched in headless, it works. When 9 parallel simulations are launched in GAMA headless, it works. But when 2 headless simulations are defined in an XML file, it crashes with the following error:

******************************************************************
* GAMA version 1.8.2                                             *
* http://gama-platform.org                                       *
* (c) 2007-2021 UMI 209 UMMISCO IRD/SU & Partners                *
******************************************************************
> GAMA: version 1.8.2                         loading on____ macosx 11.4, x86_64, JDK 17.0.2
> JAI : ImageIO extensions                    loaded for____ |jpg|tiff|bmp|gif|arx|tf8|TF8|png|ppm|jp2|tif|TIF|asc|TIFF|btf|BTF|pgm|wbmp|jpeg|pbm
> GAMA: msi.gama.core                         loaded in_____ 1155ms
> GAMA: simtools.gaml.extensions.physics      loaded in_____ 13ms
> GAMA: msi.gama.lang.gaml                    loaded in_____ 3ms
> GAMA: ummisco.gama.opengl                   loaded in_____ 6ms
> GAMA: msi.gaml.extensions.fipa              loaded in_____ 11ms
> GAMA: ummisco.gama.network                  loaded in_____ 8ms
> GAMA: ummisco.gama.java2d                   loaded in_____ 1ms
> GAMA: msi.gama.headless                     loaded in_____ 3ms
> GAMA: irit.gaml.extensions.database         loaded in_____ 13ms
> GAMA: miat.gaml.extension.pedestrian        loaded in_____ 16ms
> GAMA: ummisco.gaml.extensions.stats         loaded in_____ 34ms
> GAMA: msi.gaml.architecture.simplebdi       loaded in_____ 57ms
> GAMA: ummisco.gaml.extensions.maths         loaded in_____ 85ms
> GAMA: espacedev.gaml.extensions.genstar     loaded in_____ 5ms
> GAMA: ummisco.gama.serialize                loaded in_____ 3ms
> GAMA: simtools.gaml.extensions.traffic      loaded in_____ 32ms
> GAMA: all plugins                           loaded in_____ 1527ms
GAMA configuring and loading...
> GAMA: GAML artefacts                        built in______ 44ms
reportAndThrowIfNeeded : Cannot send the message to agent! to AListener
report error : Cannot send the message to agent! to AListener
Runtime error: Cannot send the message to agent! to AListener
reportAndThrowIfNeeded : Cannot send the message to agent! to AListener
report error : Cannot send the message to agent! to AListener
Runtime error: Cannot send the message to agent! to AListener
reportAndThrowIfNeeded : Cannot send the message to agent! to AListener
report error : Cannot send the message to agent! to AListener
Runtime error: Cannot send the message to agent! to AListener
reportAndThrowIfNeeded : Cannot send the message to agent! to AListener
report error : Cannot send the message to agent! to AListener
Runtime error: Cannot send the message to agent! to AListener
reportAndThrowIfNeeded : Cannot send the message to agent! to AListener
report error : Cannot send the message to agent! to AListener
Runtime error: Cannot send the message to agent! to AListener
reportAndThrowIfNeeded : Cannot send the message to agent! to AListener
report error : Cannot send the message to agent! to AListener
Runtime error: Cannot send the message to agent! to AListener
reportAndThrowIfNeeded : Cannot send the message to agent! to AListener
report error : Cannot send the message to agent! to AListener
Runtime error: Cannot send the message to agent! to AListener
reportAndThrowIfNeeded : Cannot send the message to agent! to AListener
report error : Cannot send the message to agent! to AListener
Runtime error: Cannot send the message to agent! to AListener
reportAndThrowIfNeeded : Cannot send the message to agent! to AListener
report error : Cannot send the message to agent! to AListener
Runtime error: Cannot send the message to agent! to AListener
reportAndThrowIfNeeded : Cannot send the message to agent! to AListener
report error : Cannot send the message to agent! to AListener
Runtime error: Cannot send the message to agent! to AListener
Cannot send the message to agent! to AListener
    at ummisco.gama.network.common.GamaNetworkException.cannotSendMessage(GamaNetworkException.java:84)
    at ummisco.gama.network.mqtt.MQTTConnector.sendMessage(MQTTConnector.java:110)
    at ummisco.gama.network.common.Connector.send(Connector.java:189)
    at ummisco.gama.network.skills.NetworkSkill.effectiveSend(NetworkSkill.java:440)
    at msi.gama.extensions.messaging.MessagingSkill.primSendMessage(MessagingSkill.java:113)
    at gaml.additions.core.GamlAdditions.lambda$1190(GamlAdditions.java:1252)
    at msi.gaml.compilation.GamaHelper.run(GamaHelper.java:73)
    at msi.gaml.compilation.IGamaHelper.run(IGamaHelper.java:49)
    at msi.gaml.statements.PrimitiveStatement.privateExecuteIn(PrimitiveStatement.java:100)
    at msi.gaml.statements.AbstractStatement.executeOn(AbstractStatement.java:46)
    at msi.gaml.statements.AbstractStatementSequence.executeOn(AbstractStatementSequence.java:62)
    at msi.gama.runtime.ExecutionScope.execute(ExecutionScope.java:440)
    at msi.gama.runtime.IScope.execute(IScope.java:581)
    at msi.gaml.statements.DoStatement.privateExecuteIn(DoStatement.java:316)
    at msi.gaml.statements.AbstractStatement.executeOn(AbstractStatement.java:46)
    at msi.gaml.statements.AbstractStatementSequence.executeOn(AbstractStatementSequence.java:62)
    at msi.gama.runtime.ExecutionScope.execute(ExecutionScope.java:440)
    at msi.gama.runtime.IScope.execute(IScope.java:568)
    at msi.gaml.statements.AbstractStatementSequence.privateExecuteIn(AbstractStatementSequence.java:72)
    at msi.gaml.architecture.reflex.ReflexStatement.privateExecuteIn(ReflexStatement.java:90)
    at msi.gaml.statements.AbstractStatement.executeOn(AbstractStatement.java:46)
    at msi.gaml.statements.AbstractStatementSequence.executeOn(AbstractStatementSequence.java:62)
    at msi.gama.runtime.ExecutionScope.execute(ExecutionScope.java:440)
    at msi.gama.runtime.IScope.execute(IScope.java:568)
    at msi.gaml.architecture.reflex.ReflexArchitecture.executeReflexes(ReflexArchitecture.java:126)
    at msi.gaml.architecture.reflex.ReflexArchitecture.executeOn(ReflexArchitecture.java:112)
    at msi.gama.runtime.ExecutionScope.execute(ExecutionScope.java:440)
    at msi.gama.metamodel.agent.AbstractAgent.doStep(AbstractAgent.java:205)
    at msi.gama.metamodel.agent.MinimalAgent.doStep(MinimalAgent.java:241)
    at msi.gama.metamodel.agent.AbstractAgent.step(AbstractAgent.java:177)
    at msi.gama.runtime.ExecutionScope.step(ExecutionScope.java:510)
    at msi.gama.runtime.concurrent.GamaExecutorService.doStep(GamaExecutorService.java:295)
    at msi.gama.runtime.concurrent.GamaExecutorService.step(GamaExecutorService.java:235)
    at msi.gama.metamodel.population.GamaPopulation.stepAgents(GamaPopulation.java:322)
    at msi.gama.metamodel.population.GamaPopulation.step(GamaPopulation.java:310)
    at msi.gama.runtime.ExecutionScope.step(ExecutionScope.java:476)
    at msi.gama.metamodel.agent.GamlAgent.stepSubPopulations(GamlAgent.java:114)
    at msi.gama.metamodel.agent.AbstractAgent.doStep(AbstractAgent.java:205)
    at msi.gama.metamodel.agent.MinimalAgent.doStep(MinimalAgent.java:241)
    at msi.gama.metamodel.agent.AbstractAgent.step(AbstractAgent.java:177)
    at msi.gama.runtime.ExecutionScope.step(ExecutionScope.java:476)
    at msi.gama.common.interfaces.IScopedStepable.step(IScopedStepable.java:27)
    at msi.gama.runtime.concurrent.SimulationRunner.lambda$0(SimulationRunner.java:105)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:833)
Message sent !

To Reproduce Steps to reproduce the behavior:

  1. Launch the attached model with the 2 XML files. reparallelmqttexception.zip

Desktop (please complete the following information):

benoitgaudou commented 2 years ago

Seems to have been fixed by d4750ea