stanfordnmbl / osim-rl

Reinforcement learning environments with musculoskeletal models
http://osim-rl.stanford.edu/
MIT License
894 stars 249 forks source link

simbody-visualiser error on a fresh setup #93

Closed denizdurduran closed 6 years ago

denizdurduran commented 6 years ago

If I follow the instructions on the page, create a fresh conda environment, and install opensim, I get the following error :

simbody-visualizer listenerThread: unrecoverable error:
SimTK Exception thrown at simbody-visualizer.cpp:2453:
  Error detected by Simbody method listenForInput(): simbody-visualizer received unexpected command 0 from simulator. Can't continue.
  (Required condition '!"unrecognized command"' was not met.)

We do see a simbody-visualizer window, but the control halts. This issue has been validated by @spMohanty

my system spec:

# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.3 LTS
Release:    16.04
Codename:   xenial

and

#uname -a
Linux -redacted- 4.13.0-041300-generic #201709031731 SMP Sun Sep 3 21:33:09 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

I started seeing this error after I updated the linux kernel.

spMohanty commented 6 years ago

For future reference, this issue was solved by compiling a custom version of simbody which ignores the unknown commands. And then replacing the packaged simbody-visualizer with the newly built simbody-visualizer.

Changes were made here and here.

I suspect this has something to do with how named pipes are handled in the said latest kernel.

kirk86 commented 6 years ago

@spMohanty I can verify that I get a similar issue:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/miniconda3/envs/tf/envs/opensim-rl/lib/python3.6/site-packages/osim/env/run.py", line 46, in __init__
    manager.integrate(state)
  File "/home/user/miniconda3/envs/tf/envs/opensim-rl/lib/python3.6/site-packages/opensim/simulation.py", line 38386, in integrate
    return _simulation.Manager_integrate(self, *args)
RuntimeError: std::exception in 'bool OpenSim::Manager::integrate(SimTK::State &)': SimTK Exception thrown at VisualizerProtocol.cpp:522:
  Error detected by Simbody method VisualizerProtocol: An attempt to write() 11160 bytes to pipe 7 failed with errno=32 (Broken pipe).
  (Required condition 'status!=-1' was not met.)

@spMohanty Could you please be kind enough to provide a minimal example on what/how to compile and which folders/files to update. Since compiling could end up requiring different tool chains as well as different flags on different compilers.

Thank you!

spMohanty commented 6 years ago

Argggg !! This issue again :’( !!

are you on a headless server ?

Ideally it should work out of the box as the conda env packages all the requirements to ensure you dont have to build it again.

But this is an irritating bug from Simbody Visualiser, and the core contributors of Simbody are also frustrated about numerous broken pipe issues, especially on Ubuntu.

But looking at the errors I believe you can get this to run with visualize=False.

Also can you provide more info about the environment you guys are getting this on ?

kirk86 commented 6 years ago

@spMohanty

are you on a headless server ?

yes! The environment is ubuntu 16.04, miniconda3, python3.6.

But looking at the errors I believe you can get this to run with visualize=False.

Yes that is true but we want to see the visualizations as well, if that's possible?

Thanks in advance!

spMohanty commented 6 years ago

Yeah i have seen this error way too many times on that setup.

And I hear that the nice folks at OpenSim are working very hard on a brand new visualiser, so hopefully this particular error will stop haunting us after thats released.

In the meantime, some things you can try are :

I am not sure if xvfb was already included in this, but you ll need xvfb as a fake display server.

kirk86 commented 6 years ago

@spMohanty Thanks a lot for the valuable input. If I understood correctly if I run it insider the docker container then theres no issue? Thanks for pointing out xvfb I wasn't aware of that.

spMohanty commented 6 years ago

@kirk86 : Yeah it will work inside the container, but then you will have to exit the container and restart it again for the next visualization else you ll get the same Broken Pipe error again.