Farama-Foundation / Gymnasium-Robotics

A collection of robotics simulation environments for reinforcement learning
https://robotics.farama.org/
MIT License
529 stars 85 forks source link

[Bug Report] Temporary XML file is written to fixed path #184

Closed nicoguertler closed 9 months ago

nicoguertler commented 1 year ago

Hi,

I would like to report a behavior of the Maze class that I believe to be a bug.

Describe the bug The temporary XML file is always written to the same fixed path (on my system /tmp/ant_maze.xml). That leads to crashes if several processes try to instantiate an environment.

Code example

import gymnasium as gym

env = gym.vector.AsyncVectorEnv([lambda: gym.make("PointMaze_Open-v3") for _ in range(10)])

This produces

ValueError: XML parse error 13:
Error=XML_ERROR_EMPTY_DOCUMENT ErrorID=13 (0xd) Line number=0

among other parsing errors.

System Info

Additional context It looks like the problem is caused by the use of path.dirname(tmp_dir) here which effectively discards the temporary directory created in the line above.

Thank you for your help!

Checklist

nicoguertler commented 1 year ago

On second thought I can see that this behavior is probably intended because the temporary directory gets removed again, sorry. I think it is still problematic though and would like to inquire if there is a chance that this problem will be solved.

roger-creus commented 12 months ago

I'm facing the same issue when running the code in a cluster. The funny thing is that it won't always crash, only sometimes. Please let me know if you fix this issue.

Kallinteris-Andreas commented 12 months ago

The maze environments were made prior to vector_env so it did not support it

PR https://github.com/Farama-Foundation/Gymnasium-Robotics/pull/185 should fix the issue @nicoguertler @roger-creus can you try it, to make sure it fixes your issue Thanks

roger-creus commented 12 months ago

This solves it @Kallinteris-Andreas ! Thank you!

nicoguertler commented 12 months ago

Works perfectly for me. Thank you very much @Kallinteris-Andreas !

Kallinteris-Andreas commented 11 months ago

@rodrigodelazcano close

rodrigodelazcano commented 11 months ago

Hey @Kallinteris-Andreas I just wanted to make sure that this issue is solved in every affected environment (mamujoco) as you mentioned in https://github.com/Farama-Foundation/Gymnasium-Robotics/pull/185#issuecomment-1768987758 before closing the issue