eclipse-sumo / sumo

Eclipse SUMO is an open source, highly portable, microscopic and continuous traffic simulation package designed to handle large networks. It allows for intermodal simulation including pedestrians and comes with a large set of tools for scenario creation.
https://eclipse.dev/sumo
Eclipse Public License 2.0
2.48k stars 1.4k forks source link

Crash after traci.simulation.loadState #13110

Open alelevente opened 1 year ago

alelevente commented 1 year ago

We experimented with the Monaco SUMO Traffic Scenario (MoST), and we have run into a sudden crash after calling traci.simulation.loadState. To be exact, the simulation loads, afterwards, a few steps can be executed, then SUMO just closes throwing a FatalTraCIError: connection closed by SUMO exception.

Unfortunately, neither SUMO nor SUMO-GUI returns any error message. We have tried to specify the beginning time of the simulation, but it did not help.

The crash can be reproduced by the following code:

import os, sys
if 'SUMO_HOME' in os.environ:
    tools = os.path.join(os.environ['SUMO_HOME'], 'tools')
    sys.path.append(tools)
else:
    sys.exit("please declare environment variable 'SUMO_HOME'")

import traci

sumoBinary = "sumo"
sumoCmd = [sumoBinary, "-c", "./MoSTScenario/scenario/most.sumocfg", "--save-state.transportables"]

#saving some states:
traci.start(sumoCmd)
step = 0
for step in range(14400*4, 20000*4):
    traci.simulationStep()
    if step%2000 == 0:
        traci.simulation.saveState("state_%d.xml"%(step//2000))
traci.close()

#loading a state:
traci.start(sumoCmd+["--begin", "19500"])
traci.simulation.loadState("most.state_19500.xml")
#the error comes within a few steps:
for step in range(3000):
    traci.simulationStep()

traci.close()

SUMO-version: 1.16.0

operating system: Ubuntu Linux 22.04 and Windows 10

namdre commented 1 year ago

likely a duplicate of #13096

namdre commented 1 year ago

I'm unable to replicate the crash with the code you sent. Notably, the state files being generated by the line traci.simulation.saveState("state_%d.xml"%(step//2000)) do not match what is being loaded in traci.simulation.loadState("most.state_19500.xml"). I did try to load the following states:

The behavior is the same with the latest dev version so there is definitely a bug here. Nevertheless if would be helpful if you could give more details on reproducing the crash.

alelevente commented 1 year ago

Thank you for your reply! We will check again with the latest SUMO version. And yes, it is very likely the same problem to the one stated in issue

13096.

Jakob Erdmann @.***> ezt írta (időpont: 2023. ápr. 28., P, 8:35):

I'm unable to replicate the crash with the code you sent. Notably, the state files being generated by the line traci.simulation.saveState("state_%d.xml"%(step//2000)) do not match what is being loaded in traci.simulation.loadState("most.state_19500.xml"). I did try to load the following states:

  • most.state_58000.xml: no problems
  • most.state_68000.xml: no problems
  • most.state_78000.xml: Error: Unknown next lane '' when loading walk for person 'pedestrian_1-1-pt_1040' from state. (sumo aborts "cleanly" with an error rather than crashing)

The behavior is the same with the latest dev version so there is definitely a bug here. Nevertheless if would be helpful if you could give more details on reproducing the crash.

— Reply to this email directly, view it on GitHub https://github.com/eclipse/sumo/issues/13110#issuecomment-1527060705, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGHEECGNIV7AKD32ZXDB4PLXDNQMXANCNFSM6AAAAAAXIZRGGA . You are receiving this because you authored the thread.Message ID: @.***>

m-kro commented 1 year ago

@alelevente Do you have any news for us? Did you check with the latest SUMO version?

alelevente commented 1 year ago

@m-kro, I have just tested it with SUMO v1.18.0, and the bug still exists. As @namdre said, SUMO now gives an error message while loading in case we also saved the state of the pedestrians. In the save file, there are some weird (e.g., -nan) states for this person:

`

    </person>`