Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gama legacy headless raises an NPE on 1.9.3 docker #352

Open
romainreuillon opened this issue Oct 9, 2024 · 10 comments
Open

Gama legacy headless raises an NPE on 1.9.3 docker #352

romainreuillon opened this issue Oct 9, 2024 · 10 comments
Labels
About Headless This issue or request concerns GAMA headless mode

Comments

@romainreuillon
Copy link

OpenMOLE is based on using the docker container of GAMA and gama-headless.sh. When running with GAMA docker up to 1.9.2 the predator prey models runs perfectly. However when running this model with the 1.9.3 docker it raises an NPE:

java.lang.NullPointerException: Cannot invoke "msi.gaml.expressions.IExpression.value(msi.gama.runtime.IScope)" because the return value of "msi.gama.kernel.experiment.IExperimentPlan.getStopCondition()" is null

Note that this error arrise only using the docker container as using the gama headless directly works ok.

To reproduce it you can extract the archive linked to the issue. It contains:

  • the predator prey gaml file
  • an xml describing the experiment

Go in the extracted directory and run:
docker run -it -v $PWD:/xp gamaplatform/gama:1.9.3 /xp/exp.xml /tmp/out

It should produce the following error:

******************************************************************
* GAMA version 1.9.3                                             *
* http://gama-platform.org                                       *
* (c) 2007-2023 UMI 209 UMMISCO IRD/SU & Partners                *
******************************************************************
> FLAG  : enable_debug                                  set to________ true
> FLAG  : enable_logging                                set to________ true
> FLAG  : use_global_preference_store                   set to________ true
> GAMA  : version 1.9.3                                 loading on____ linux 6.8.0-45-generic, x86_64, JDK 17-ea
> JAI   : ImageIO extensions                            loaded for____ BTF|TF8|TIF|TIFF|arx|asc|bmp|btf|gif|jp2|jpeg|jpg|pbm|pgm|png|ppm|tf8|tif|tiff|wbmp
Oct 09, 2024 11:06:06 AM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.
> GAMA  : Plugin msi.gama.core                          loaded in_____ 569ms
> GAMA  : Plugin irit.gaml.extensions.database          loaded in_____ 10ms
> GAMA  : Plugin miat.gaml.extensions.pedestrian        loaded in_____ 8ms
> GAMA  : Plugin msi.gama.headless                      loaded in_____ 1ms
> GAML  : Initializing parser                           done in_______ 93ms
> GAMA  : Plugin msi.gama.lang.gaml                     loaded in_____ 97ms
> GAMA  : Plugin msi.gaml.architecture.simplebdi        loaded in_____ 32ms
> GAMA  : Plugin msi.gaml.extensions.fipa               loaded in_____ 5ms
> GAMA  : Plugin simtools.gaml.extensions.physics       loaded in_____ 6ms
> GAMA  : Plugin simtools.gaml.extensions.traffic       loaded in_____ 16ms
> GAMA  : Plugin ummisco.gama.network                   loaded in_____ 2ms
> GAMA  : Plugin ummisco.gama.serialize                 loaded in_____ 3ms
> GAMA  : Snapshot services                             inactive______ (headless mode)
> GAMA  : Plugin ummisco.gaml.extensions.image          loaded in_____ 11ms
> GAMA  : Plugin ummisco.gaml.extensions.maths          loaded in_____ 42ms
> GAMA  : Plugin ummisco.gaml.extensions.stats          loaded in_____ 17ms
> GAMA  : Loading extensions to 'create'                done in_______ 3ms
> GAMA  : Loading extensions to 'save'                  done in_______ 58ms
> GAMA  : Loading extensions to 'draw'                  done in_______ 1ms
> GAMA  : Loading extensions to 'event'                 done in_______ 0ms
> GAMA  : Gathering built-in models                     done in_______ 1ms
> GAMA  : Loading constants                             done in_______ 69ms
> GAML  : Plugins with language additions               loaded in_____ 1769ms
GAMA configuring and loading...
> GAML  : Artifacts                                     built in______ 23ms
java.lang.NullPointerException: Cannot invoke "msi.gaml.expressions.IExpression.value(msi.gama.runtime.IScope)" because the return value of "msi.gama.kernel.experiment.IExperimentPlan.getStopCondition()" is null
@romainreuillon romainreuillon added the About Headless This issue or request concerns GAMA headless mode label Oct 9, 2024
@romainreuillon romainreuillon added this to the 1.9.3 milestone Oct 9, 2024
@romainreuillon
Copy link
Author

gama-bug.tar.gz

@lesquoyb lesquoyb removed this from the 1.9.3 milestone Oct 11, 2024
@lesquoyb
Copy link
Contributor

Hello, I think this issue has been solved already, could you try in your environment with the alpha version (gamaplatform/gama:alpha) ?

@romainreuillon
Copy link
Author

romainreuillon commented Oct 14, 2024

Thank you for the quick answer.

I tried it with the same model code it gave me a compilation error:

[reuillon:~/Documents/Tmp/gama-bug] 1 $ docker run -it -v $PWD:/xp  gamaplatform/gama:alpha /xp/exp.xml /tmp/out
Unable to find image 'gamaplatform/gama:alpha' locally
alpha: Pulling from gamaplatform/gama
c6a83fedfae6: Pull complete 
479e64820c60: Pull complete 
cf4e44e3ea2c: Pull complete 
238c673ab2bb: Pull complete 
eca2c62bac89: Pull complete 
dc62d18bfdf2: Pull complete 
a218874c45c9: Pull complete 
4f4fb700ef54: Pull complete 
Digest: sha256:f381dcea8d1f7dac3bb18752a5ce263c32a0e90474dc14b8799d73a320d5f67c
Status: Downloaded newer image for gamaplatform/gama:alpha
******************************************************************
* GAMA version 2024.8.0-SNAPSHOT                                         *
* http://gama-platform.org                                       *
* (c) 2007-2024 UMI 209 UMMISCO IRD/SU & Partners                *
******************************************************************
> FLAG  : enable_debug                                  set to________ true
> FLAG  : enable_logging                                set to________ true
> FLAG  : use_global_preference_store                   set to________ true
> JAI   : ImageIO extensions                            loaded for____ BTF|TF8|TIF|TIFF|arx|asc|bmp|btf|gif|jp2|jpeg|jpg|pbm|pgm|png|ppm|tf8|tif|tiff|wbmp
> GAMA  : version 2024.8.0-SNAPSHOT                     loading on____ Linux 6.8.0-45-generic, processor amd64, JDK OpenJDK 64-Bit Server VM Eclipse Adoptium version 21.0.4+7-LTS
Oct 14, 2024 1:56:12 PM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.
> GAMA  : Plugin gama.core                              loaded in_____ 334ms
> GAMA  : Plugin gama.extension.bdi                     loaded in_____ 27ms
> GAMA  : Plugin gama.extension.database                loaded in_____ 9ms
> GAMA  : Plugin gama.extension.fipa                    loaded in_____ 5ms
> GAMA  : Snapshot services                             inactive______ (headless mode)
> GAMA  : Plugin gama.extension.image                   loaded in_____ 18ms
> GAMA  : Plugin gama.extension.maths                   loaded in_____ 38ms
> GAMA  : Plugin gama.extension.network                 loaded in_____ 2ms
> GAMA  : Plugin gama.extension.pedestrian              loaded in_____ 8ms
> GAMA  : Plugin gama.extension.physics                 loaded in_____ 6ms
> GAMA  : Plugin gama.extension.serialize               loaded in_____ 3ms
> GAMA  : Plugin gama.extension.stats                   loaded in_____ 23ms
> GAMA  : Plugin gama.extension.traffic                 loaded in_____ 13ms
> GAMA  : Plugin gama.headless                          loaded in_____ 1ms
> GAML  : Initializing parser                           done in_______ 92ms
> GAMA  : Plugin gaml.compiler                          loaded in_____ 94ms
> GAMA  : Loading extensions to 'create'                done in_______ 1ms
> GAMA  : Loading extensions to 'save'                  done in_______ 39ms
> GAMA  : Loading extensions to 'draw'                  done in_______ 1ms
> GAMA  : Loading extensions to 'event'                 done in_______ 1ms
> GAMA  : Gathering built-in models                     done in_______ 1ms
> GAMA  : Loading constants                             done in_______ 65ms
> GAML  : Plugins with language additions               loaded in_____ 726ms
GAMA configuring and loading...
> GAML  : Artifacts                                     built in______ 23ms
gama.gaml.compilation.GamaCompilationFailedException: The model couldn't be compiled because of compilation errors

Then I tried to run an experiment for a more recent example taken from github: https://github.com/gama-platform/gama/blob/2024-06/gama.library/models/Tutorials/Predator%20Prey/models/Model%2012.gaml, and I got another NPE:

[reuillon:~/Documents/Tmp/gama-bug] $ docker run -it -v $PWD:/xp  gamaplatform/gama:alpha -xml prey_predator /xp/pp12.gaml /xp/pp12.xml 
******************************************************************
* GAMA version 2024.8.0-SNAPSHOT                                         *
* http://gama-platform.org                                       *
* (c) 2007-2024 UMI 209 UMMISCO IRD/SU & Partners                *
******************************************************************
> FLAG  : enable_debug                                  set to________ true
> FLAG  : enable_logging                                set to________ true
> FLAG  : use_global_preference_store                   set to________ true
> JAI   : ImageIO extensions                            loaded for____ BTF|TF8|TIF|TIFF|arx|asc|bmp|btf|gif|jp2|jpeg|jpg|pbm|pgm|png|ppm|tf8|tif|tiff|wbmp
> GAMA  : version 2024.8.0-SNAPSHOT                     loading on____ Linux 6.8.0-45-generic, processor amd64, JDK OpenJDK 64-Bit Server VM Eclipse Adoptium version 21.0.4+7-LTS
Oct 14, 2024 2:06:44 PM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.
> GAMA  : Plugin gama.core                              loaded in_____ 361ms
> GAMA  : Plugin gama.extension.bdi                     loaded in_____ 43ms
> GAMA  : Plugin gama.extension.database                loaded in_____ 9ms
> GAMA  : Plugin gama.extension.fipa                    loaded in_____ 5ms
> GAMA  : Snapshot services                             inactive______ (headless mode)
> GAMA  : Plugin gama.extension.image                   loaded in_____ 12ms
> GAMA  : Plugin gama.extension.maths                   loaded in_____ 36ms
> GAMA  : Plugin gama.extension.network                 loaded in_____ 2ms
> GAMA  : Plugin gama.extension.pedestrian              loaded in_____ 8ms
> GAMA  : Plugin gama.extension.physics                 loaded in_____ 5ms
> GAMA  : Plugin gama.extension.serialize               loaded in_____ 4ms
> GAMA  : Plugin gama.extension.stats                   loaded in_____ 11ms
> GAMA  : Plugin gama.extension.traffic                 loaded in_____ 13ms
> GAMA  : Plugin gama.headless                          loaded in_____ 1ms
> GAML  : Initializing parser                           done in_______ 95ms
> GAMA  : Plugin gaml.compiler                          loaded in_____ 97ms
> GAMA  : Loading extensions to 'create'                done in_______ 2ms
> GAMA  : Loading extensions to 'save'                  done in_______ 46ms
> GAMA  : Loading extensions to 'draw'                  done in_______ 2ms
> GAMA  : Loading extensions to 'event'                 done in_______ 0ms
> GAMA  : Gathering built-in models                     done in_______ 2ms
> GAMA  : Loading constants                             done in_______ 65ms
> GAML  : Plugins with language additions               loaded in_____ 761ms
GAMA configuring and loading...
> GAML  : Artifacts                                     built in______ 25ms
/xp/pp12.gaml model is being compiled...
Parameter file saved at: /xp/pp12.xml
[reuillon:~/Documents/Tmp/gama-bug] $ docker run -it -v $PWD:/xp  gamaplatform/gama:alpha /xp/pp12.xml /tmp/out
******************************************************************
* GAMA version 2024.8.0-SNAPSHOT                                         *
* http://gama-platform.org                                       *
* (c) 2007-2024 UMI 209 UMMISCO IRD/SU & Partners                *
******************************************************************
> FLAG  : enable_debug                                  set to________ true
> FLAG  : enable_logging                                set to________ true
> FLAG  : use_global_preference_store                   set to________ true
> JAI   : ImageIO extensions                            loaded for____ BTF|TF8|TIF|TIFF|arx|asc|bmp|btf|gif|jp2|jpeg|jpg|pbm|pgm|png|ppm|tf8|tif|tiff|wbmp
> GAMA  : version 2024.8.0-SNAPSHOT                     loading on____ Linux 6.8.0-45-generic, processor amd64, JDK OpenJDK 64-Bit Server VM Eclipse Adoptium version 21.0.4+7-LTS
Oct 14, 2024 2:07:15 PM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.
> GAMA  : Plugin gama.core                              loaded in_____ 363ms
> GAMA  : Plugin gama.extension.bdi                     loaded in_____ 28ms
> GAMA  : Plugin gama.extension.database                loaded in_____ 8ms
> GAMA  : Plugin gama.extension.fipa                    loaded in_____ 5ms
> GAMA  : Snapshot services                             inactive______ (headless mode)
> GAMA  : Plugin gama.extension.image                   loaded in_____ 11ms
> GAMA  : Plugin gama.extension.maths                   loaded in_____ 51ms
> GAMA  : Plugin gama.extension.network                 loaded in_____ 2ms
> GAMA  : Plugin gama.extension.pedestrian              loaded in_____ 8ms
> GAMA  : Plugin gama.extension.physics                 loaded in_____ 6ms
> GAMA  : Plugin gama.extension.serialize               loaded in_____ 3ms
> GAMA  : Plugin gama.extension.stats                   loaded in_____ 13ms
> GAMA  : Plugin gama.extension.traffic                 loaded in_____ 14ms
> GAMA  : Plugin gama.headless                          loaded in_____ 2ms
> GAML  : Initializing parser                           done in_______ 93ms
> GAMA  : Plugin gaml.compiler                          loaded in_____ 95ms
> GAMA  : Loading extensions to 'create'                done in_______ 2ms
> GAMA  : Loading extensions to 'save'                  done in_______ 44ms
> GAMA  : Loading extensions to 'draw'                  done in_______ 2ms
> GAMA  : Loading extensions to 'event'                 done in_______ 0ms
> GAMA  : Gathering built-in models                     done in_______ 1ms
> GAMA  : Loading constants                             done in_______ 71ms
> GAML  : Plugins with language additions               loaded in_____ 766ms
GAMA configuring and loading...
> GAML  : Artifacts                                     built in______ 22ms
java.lang.NullPointerException: Cannot invoke "gama.headless.common.DataType.name()" because the return value of "gama.headless.job.ListenedVariable.getDataType()" is null

Any idea of what is going on?

@lesquoyb
Copy link
Contributor

for the compilation error it probably is the declaration of a parameter with the parameter facet, it won't be supported anymore in the next release and has been removed from the alpha. The supported way to do it is to declare parameters in the experiments.
If you cannot find where the compilation error is, the easiest way would be to open the file in the gama editor to get the complete compilation error message.

For the second point, I tried to reproduce but on my computer with the git version it works normally, I will check with the docker version later.

@lesquoyb
Copy link
Contributor

Ok so I tried in docker and have the same error message. For now I have no clue what could be the difference between the docker environment and the git version. @RoiArthurB any idea ?

@lesquoyb
Copy link
Contributor

lesquoyb commented Oct 24, 2024

Turns out it is linked to the output and more particularly the displays. If I comment out the displays from the xml everything works fine.
Could it be because the snapshot services are inactive?
From the log I can see this line at init:

> GAMA  : Snapshot services                             inactive______ (headless mode)

@lesquoyb
Copy link
Contributor

More updates:

  • I found the issue and it is not related to docker at all, no need to investigate this @RoiArthurB my local setup was just weird and I can now reproduce with git version
  • The problem itself was just that there was no handling of how to log displays properly
  • I fixed it locally, but now I'm wondering when this was introduced and why, once I'm sure it was just something like forgetting this case while rewriting the headless I will commit to the repo.
  • The fact that there was no stack trace at all linked to the NPE is a bit weird, I will also have a look at that

lesquoyb added a commit that referenced this issue Oct 24, 2024
For now I'm just handling the case where the dataType variable is not defined.
But if we run headless legacy on Model 12.gaml from model library, we define the displays as 2d explicitly, so shouldn't dataType be 2d display ? And if so, what is the expected dataType in case of 3d display ?
@lesquoyb
Copy link
Contributor

It should be fixed in the current alpha, could you test it ?
By the way, if you have a use of legacy headless where you don't need to modify the generated xml apart from the number of steps you could try to run the simulation directly in one step with the -gaml option as described here

@lesquoyb lesquoyb moved this from Todo to To Test in GAMA 2024-11 Nov 11, 2024
@romainreuillon
Copy link
Author

Nice ! Thanks

Would it be possible to push the latest alpha version to the docker hub? So I can test it in OpenMOLE.

Actually in OpenMOLE the XML is modified to set the input parameters and output values are parsed at the end of the simulation. From what I read the gaml version is not yet ready for that. I am mistaken?

@lesquoyb
Copy link
Contributor

lesquoyb commented Nov 12, 2024

Oops, I thought the docker image was automatically updated with each new build, maybe it's only with the stable release, so that's a new issue.
In the meantime, @RoiArthurB could you manually do it?

Also yes in this case you cannot use the -gaml flag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
About Headless This issue or request concerns GAMA headless mode
Projects
Status: To Test
Development

No branches or pull requests

2 participants