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

SUMO can Freeze When Reloading #480

Closed
Gamenot opened this issue Jan 26, 2021 · 1 comment
Closed

SUMO can Freeze When Reloading #480

Gamenot opened this issue Jan 26, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@Gamenot
Copy link
Collaborator

Gamenot commented Jan 26, 2021

BUG REPORT

I have confirmed, SUMO can freeze when reloading too many times.

SMARTS Version
0.4.12

Previous associated issues
#465 (comment)

Steps to reproduce the bug
Run the following code:

import os

import gym
from smarts.core.agent_interface import AgentInterface, AgentType
from smarts.core.agent import AgentSpec, Agent
import numpy as np


class SimpleAgent(Agent):
    def __init__(self):
        self.action_space = gym.spaces.Box(
            low=np.array([0, 0, -1.0]), high=np.array([1.0, 1.0, 1.0]), dtype=np.float32
        )

    def act(self, obs):
        # return "keep_lane"
        return self.action_space.sample()


agent_spec = AgentSpec(
    interface=AgentInterface.from_type(AgentType.Full, max_episode_steps=None),
    agent_builder=SimpleAgent,
)

agent_specs = {
    "Agent-001": agent_spec,
    # "Agent-008": agent_spec,
}

env = gym.make(
    "smarts.env:hiway-v0",
    scenarios=["scenarios/loop"],
    agent_specs=agent_specs,
)

agents = {
    agent_id: agent_spec.build_agent()
    for agent_id, agent_spec in agent_specs.items()
}
observations = env.reset()

for i in range(100000000):
    print(i)
    agent_actions = {
        agent_id: agents[agent_id].act(agent_obs)
        for agent_id, agent_obs in observations.items()
    }
    for agent_id, agent_obs in observations.items():
        a = agents[agent_id].act(agent_obs)
    observations, r, d, i = env.step(agent_actions)
    observations = env.reset()

Resulting and expected behaviour
Expect to get 100000000 resets but SUMO crashes before then.

Error logs and screenshots

pybullet build time: Dec 23 2020 01:47:29
32427
pybullet build time: Dec 23 2020 01:47:29
32428
pybullet build time: Dec 23 2020 01:47:29
32429
Traceback (most recent call last):
 File "examples/simple_example_test.py", line 55, in <module>
   observations = env.reset()
 File "/home/dev/Desktop/repos/NewSMARTS/SMARTS/smarts/env/hiway_env.py", line 188, in reset
   env_observations = self._smarts.reset(scenario)
 File "/home/dev/Desktop/repos/NewSMARTS/SMARTS/smarts/core/smarts.py", line 314, in reset
   self.setup(scenario)
 File "/home/dev/Desktop/repos/NewSMARTS/SMARTS/smarts/core/smarts.py", line 361, in setup
   provider_state = self._setup_providers(self._scenario)
 File "/home/dev/Desktop/repos/NewSMARTS/SMARTS/smarts/core/smarts.py", line 656, in _setup_providers
   provider_state.merge(provider.setup(scenario))
 File "/home/dev/Desktop/repos/NewSMARTS/SMARTS/smarts/core/sumo_traffic_simulation.py", line 247, in setup
   self._traci_conn.simulation.subscribe(
 File "/usr/share/sumo/tools/traci/_simulation.py", line 468, in subscribe
   Domain.subscribe(self, "", varIDs, begin, end)
 File "/usr/share/sumo/tools/traci/domain.py", line 209, in subscribe
   self._connection._subscribe(self._subscribeID, begin, end, objectID, varIDs, parameters)
 File "/usr/share/sumo/tools/traci/connection.py", line 242, in _subscribe
   result = self._sendCmd(cmdID, (begin, end), objID, format, *args)
 File "/usr/share/sumo/tools/traci/connection.py", line 180, in _sendCmd
   return self._sendExact()
 File "/usr/share/sumo/tools/traci/connection.py", line 90, in _sendExact
   raise FatalTraCIError("connection closed by SUMO")
traci.exceptions.FatalTraCIError: connection closed by SUMO

My device also ended with a surprising error:

image
System information

  • Operating system & Environment [Please note if using Docker]:
    • Ubuntu 18.04
  • Number of system cores available
    • 16
  • Python version [Please note if using Jupyter]
    • Python 3.7
  • Python packages [e.g. from pip freeze]
  • SUMO version
    • Eclipse SUMO sumo Version 1.8.0
  • Date when bug occurred
    • 2020_01_26

Impact [If known]
Reloading a single scenario repeatedly may crash SUMO.

@Gamenot Gamenot changed the title SUMO can freeze when Reloading SUMO can Freeze When Reloading Jan 26, 2021
@Gamenot Gamenot added this to the Backlog milestone Jan 27, 2021
@Gamenot Gamenot added the bug Something isn't working label Jan 27, 2021
@Gamenot
Copy link
Collaborator Author

Gamenot commented May 27, 2021

Addressed in #852

@Gamenot Gamenot closed this as completed May 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant