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

Simulation docker container crashes #93

Open
1 of 3 tasks
reyespinr opened this issue Nov 10, 2022 · 3 comments
Open
1 of 3 tasks

Simulation docker container crashes #93

reyespinr opened this issue Nov 10, 2022 · 3 comments

Comments

@reyespinr
Copy link

Types of Issue

  • Anomaly report (something appears to not work correctly)
  • Enhancement request (describe the enhancement being requested)
  • Other (please ensure the description clarifies why the issue doesn’t fall into either of the above categories)

Descriptive summary

Launching carma simulation using the current version gives a null pointer exception. Log files report that MOSAIC seems to be the issue.

Carma version where this issue was discovered

carma-simulation-1.0.1

Expected behavior

Town04_20 should launch successfully

Actual behavior

We receive a null pointer exception and the docker container closes. Our machine is running Ubuntu 20.04 running rootless docker.

Steps to reproduce the actual behavior

  1. Used carma-simulation-1.0.1 docker image
  2. Launched simulation following the commands in documentation
./run.sh -v carma-simulation-1.0.1 -s --from_docker Town04_20

or (for HelloWorld scenario)

./run.sh -v carma-simulation-1.0.1

Log output

MOSAIC.log (Town04_20)

2022-11-10 15:02:56,993 INFO  ROOT - Running Eclipse MOSAIC 22.1-SNAPSHOT on Java JRE v11.0.16 (Ubuntu)
2022-11-10 15:02:57,092 INFO  MosaicStarter - Federate sumo: No port given. Using free port: 36823
2022-11-10 15:02:57,098 INFO  FederationManagement - Start federation with id 'Town04'
2022-11-10 15:02:57,099 INFO  FederationManagement - Add ambassador/federate with id 'application'
2022-11-10 15:02:57,099 INFO  FederationManagement - Add ambassador/federate with id 'carla'
2022-11-10 15:02:57,099 INFO  FederationManagement - Deploying federate 'carla' locally in ./tmp/carla
2022-11-10 15:02:57,101 INFO  FederationManagement - Starting federate 'carla' locally in ./tmp/carla
2022-11-10 15:02:57,102 INFO  FederationManagement - Add ambassador/federate with id 'mapping'
2022-11-10 15:02:57,102 INFO  FederationManagement - Add ambassador/federate with id 'sumo'
2022-11-10 15:02:57,102 INFO  FederationManagement - Deploying federate 'sumo' locally in ./tmp/sumo
2022-11-10 15:02:57,121 INFO  FederationManagement - Starting federate 'sumo' locally in ./tmp/sumo
2022-11-10 15:02:57,123 WARN  ROOT - You didn't define any spawners in your mapping config, which means that there will be no vehicles in your simulation. Keep this in mind when troubleshooting.
2022-11-10 15:03:02,619 ERROR MosaicStarter - Stopping simulation due to a critical error.
java.lang.NullPointerException: null
	at org.eclipse.mosaic.fed.sumo.traci.TraciClient.<init>(TraciClient.java:97)
	at org.eclipse.mosaic.fed.sumo.traci.TraciClient.<init>(TraciClient.java:84)
	at org.eclipse.mosaic.fed.sumo.ambassador.AbstractSumoAmbassador.initTraci(AbstractSumoAmbassador.java:428)
	at org.eclipse.mosaic.fed.sumo.ambassador.SumoAmbassador.sumoStartupProcedure(SumoAmbassador.java:249)
	at org.eclipse.mosaic.fed.sumo.ambassador.SumoAmbassador.receiveInteraction(SumoAmbassador.java:220)
	at org.eclipse.mosaic.fed.sumo.ambassador.SumoAmbassador.processInteraction(SumoAmbassador.java:126)
	at org.eclipse.mosaic.rti.api.AbstractFederateAmbassador.advanceTime(AbstractFederateAmbassador.java:108)
	at org.eclipse.mosaic.rti.time.SequentialTimeManagement.runSimulation(SequentialTimeManagement.java:90)
	at org.eclipse.mosaic.starter.MosaicSimulation.runSimulation(MosaicSimulation.java:189)
	at org.eclipse.mosaic.starter.MosaicStarter.execute(MosaicStarter.java:135)
	at org.eclipse.mosaic.starter.MosaicStarter.main(MosaicStarter.java:77)

console output (Town04_20):

##### Running usdotfhwastol/carma-simulation:carma-simulation-1.0.1 docker container with Town04_20 scenario #####
2022-11-10 16:13:00,724 INFO  ROOT - Running Eclipse MOSAIC 22.1-SNAPSHOT on Java JRE v11.0.16 (Ubuntu)
2022-11-10 16:13:00,825 INFO  FederationManagement - Start federation with id 'Town04'
2022-11-10 16:13:00,826 INFO  FederationManagement - Add ambassador/federate with id 'application'
2022-11-10 16:13:00,826 INFO  FederationManagement - Add ambassador/federate with id 'carla'
2022-11-10 16:13:00,826 INFO  FederationManagement - Deploying federate 'carla' locally in ./tmp/carla
2022-11-10 16:13:00,829 INFO  FederationManagement - Starting federate 'carla' locally in ./tmp/carla
2022-11-10 16:13:00,829 INFO  FederationManagement - Add ambassador/federate with id 'mapping'
2022-11-10 16:13:00,829 INFO  FederationManagement - Add ambassador/federate with id 'sumo'
2022-11-10 16:13:00,829 INFO  FederationManagement - Deploying federate 'sumo' locally in ./tmp/sumo
2022-11-10 16:13:00,847 INFO  FederationManagement - Starting federate 'sumo' locally in ./tmp/sumo
2022-11-10 16:13:00,849 WARN  ROOT - You didn't define any spawners in your mapping config, which means that there will be no vehicles in your simulation. Keep this in mind when troubleshooting.
======================================================================wn)                        
| SUMO will now be started in GUI Mode.                              |
| Please make sure you have started Eclipse MOSAIC with "-w 0"              |
| Start the simulation manually in SUMO-GUI.                         |
======================================================================

-------------------------------------------------------------------
 Stopping simulation due to a critical error:
	- NullPointerException: 
	- Root Cause: NullPointerException: 
 Please see the log files for details.
	- Log-Directory: logs/log-20221110-161300-Town04

 Eclipse MOSAIC will now shutdown.
-------------------------------------------------------------------

MOSAIC.log (HelloWorld)

2022-11-10 15:51:47,845 INFO  ROOT - Running Eclipse MOSAIC 22.1-SNAPSHOT on Java JRE v11.0.16 (Ubuntu)
2022-11-10 15:51:47,925 INFO  MosaicStarter - Federate sumo: No port given. Using free port: 35297
2022-11-10 15:51:47,932 INFO  FederationManagement - Start federation with id 'HelloWorld'
2022-11-10 15:51:47,932 INFO  FederationManagement - Add ambassador/federate with id 'application'
2022-11-10 15:51:47,933 INFO  FederationManagement - Add ambassador/federate with id 'mapping'
2022-11-10 15:51:47,933 INFO  FederationManagement - Add ambassador/federate with id 'sns'
2022-11-10 15:51:47,933 INFO  FederationManagement - Add ambassador/federate with id 'sumo'
2022-11-10 15:51:47,933 INFO  FederationManagement - Deploying federate 'sumo' locally in ./tmp/sumo
2022-11-10 15:51:47,935 INFO  FederationManagement - Starting federate 'sumo' locally in ./tmp/sumo
2022-11-10 15:51:47,935 INFO  FederationManagement - Add ambassador/federate with id 'output'
2022-11-10 15:51:47,935 INFO  OutputAmbassador - Initialize configuration of OutputAmbassador
2022-11-10 15:51:48,156 INFO  OutputAmbassador - Registered output generator 'file' for messages [VehicleRegistration, VehicleUpdates]. Update interval=5
2022-11-10 15:51:48,163 INFO  OutputAmbassador - Registered output generator 'websocket' for messages [RsuRegistration, VehicleRegistration, VehicleUpdates, V2xMessageReception, V2xMessaTown04_20)geTransmission]. Update interval=1
2022-11-10 15:51:53,531 ERROR MosaicStarter - Stopping simulation due to a critical error.
java.lang.NullPointerException: null
	at org.eclipse.mosaic.fed.sumo.traci.TraciClient.<init>(TraciClient.java:97)
	at org.eclipse.mosaic.fed.sumo.traci.TraciClient.<init>(TraciClient.java:84)
	at org.eclipse.mosaic.fed.sumo.ambassador.AbstractSumoAmbassador.initTraci(AbstractSumoAmbassador.java:428)
	at org.eclipse.mosaic.fed.sumo.ambassador.SumoAmbassador.sumoStartupProcedure(SumoAmbassador.java:249)
	at org.eclipse.mosaic.fed.sumo.ambassador.SumoAmbassador.receiveInteraction(SumoAmbassador.java:220)
	at org.eclipse.mosaic.fed.sumo.ambassador.SumoAmbassador.processInteraction(SumoAmbassador.java:126)
	at org.eclipse.mosaic.rti.api.AbstractFederateAmbassador.advanceTime(AbstractFederateAmbassador.java:108)
	at org.eclipse.mosaic.rti.time.SequentialTimeManagement.runSimulation(SequentialTimeManagement.java:90)
	at org.eclipse.mosaic.starter.MosaicSimulation.runSimulation(MosaicSimulation.java:189)
	at org.eclipse.mosaic.starter.MosaicStarter.execute(MosaicStarter.java:135)
	at org.eclipse.mosaic.starter.MosaicStarter.main(MosaicStarter.java:77)

Related work

@xqgex
Copy link

xqgex commented Jan 19, 2023

I have the exact same error message with the latest tag carma-simulation-1.0.1

The error is raised at TraciClient.java:97:

https://github.com/usdot-fhwa-stol/carma-simulation/blob/0c8a6502dfba4d1712e2059268ac4b88efa9d78e/co-simulation/fed/mosaic-sumo/src/main/java/org/eclipse/mosaic/fed/sumo/traci/TraciClient.java#L87-L97

So I assume that sumoServerSocket is null and if so, it is an error from AbstractSumoAmbassador.java:428 that send socket without checking that it is not null

https://github.com/usdot-fhwa-stol/carma-simulation/blob/0c8a6502dfba4d1712e2059268ac4b88efa9d78e/co-simulation/fed/mosaic-sumo/src/main/java/org/eclipse/mosaic/fed/sumo/ambassador/AbstractSumoAmbassador.java#L414-L428


While digging into the problem I've found two additional "mistakes" regarding the logs, as can be seen in the output:

======================================================================wn)                        
| SUMO will now be started in GUI Mode.                              |
| Please make sure you have started Eclipse MOSAIC with "-w 0"              |
| Start the simulation manually in SUMO-GUI.                         |
======================================================================

There is a missing new line (\n) and an unaligned printing.

The missing newLine is at AbstractTimeManagement.java lines 168+231.

The code need to be changed from:

https://github.com/usdot-fhwa-stol/carma-simulation/blob/0c8a6502dfba4d1712e2059268ac4b88efa9d78e/co-simulation/rti/mosaic-rti-core/src/main/java/org/eclipse/mosaic/rti/time/AbstractTimeManagement.java#L168

To:

        progressLogger.info("Simulating: {}ns ({}s) - {}%" + newLine,

And from:

https://github.com/usdot-fhwa-stol/carma-simulation/blob/0c8a6502dfba4d1712e2059268ac4b88efa9d78e/co-simulation/rti/mosaic-rti-core/src/main/java/org/eclipse/mosaic/rti/time/AbstractTimeManagement.java#L231

To:

            progressLogger.info("Simulating: {}ns ({}s / {}s) - {}% (RTF:{}, ETC:{})" + newLine,

And the unaligned "box" is at LogStatements.java:64, the repeat value is 7 and not 14:

The code need to be changed from:

https://github.com/usdot-fhwa-stol/carma-simulation/blob/0c8a6502dfba4d1712e2059268ac4b88efa9d78e/co-simulation/fed/mosaic-sumo/src/main/java/org/eclipse/mosaic/fed/sumo/ambassador/LogStatements.java#L64

To:

        System.out.println("| Please make sure you have started Eclipse MOSAIC with \"-w 0\"" + StringUtils.repeat(" ", 7) + "|");

@pkallep
Copy link

pkallep commented Jul 21, 2023

I have this same issue running everything on a native linux machine (ubuntu 20.04). Is there a fix for this issue?

Thank you.

@chengyuan0124
Copy link
Contributor

We recently released a new version 4.4.3, you can pull the docker image from dockerhub. Run the image by docker run --rm -it --gpus all --net=host -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY -e QT_X11_NO_MITSHM=1 --user=carma usdotfhwastol/cdasim:carma-system-4.4.3 /bin/bash. Once you get into the container, run ./mosaic.sh -s Town04_20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants