Gazebo is freezing while using Turtlebot3-Simulation after awhile

Hi,

for my university, I created a project in which I try different Reinforcement Learning algorithms using Turtlebot3 and the Gazebo simulation which comes with the robot. I designed the interface using the OpenAi-Gym definiton.

After running my project multiple times, I may have encountered a problem on which I hope to get further opinions:
After each episode (the simulations runs for up to 2min), I reset the simulation by calling the service to pause the simulation (pause_physics), then the program waits for 1 second, calls the service to reset the simulation (reset_simulation), the programs waits again for 1 second, and then unpauses the simulation by calling the unpause_physics-service. After that, I spin the /scan and /cmd_vel node using rclpy.spin_once() to read the LaserScan data and the velocity data.
The problem is not that it does not work in general but rather that after a while - after around 3:15 hours - the Gazebo simulation freezes and the LaserScan data is not available anymore. I am now wondering whether this a bug of the Gazebo simulation or of my service call.
Since there is no one at my university that I can talk to about this, I am asking here. Maybe someone with fresh eyes on this has any suggestion that could help. Do you have any idea what could be wrong or where to ask? I think there might be something wrong with the service call or with the gazebo simulation. Additionally, I am receiving messages using rqt that I haven’t understood yet:

  • Negative sim time difference detected. (Info)
  • Moved backwards in time, re-publishing joint transforms! (Warn)

Could these types of infos/warnings point to the cause of the freezing of the Gazebo simulation?

I attached a few screenshots to the post, e.g. the Gazebo situation in which the simulation froze, the node graph and the rqt-messages I received.

I very much appreciate every help and all thoughts on this. If this is not the right thread for this question, please let me know where this would better fit.

All the best and a happy new year!