gazebosim / sdformat

Simulation Description Format (SDFormat) parser and description files.
http://sdformat.org
Apache License 2.0
167 stars 95 forks source link

Segmentation Fault in sdf::getBestSupportedModelVersion #152

Closed osrf-migration closed 7 years ago

osrf-migration commented 7 years ago

Original report (archived issue) by Dominic Jud (Bitbucket: djud).


Since the last update of sdformat4, there is a segmentation fault occurring that was not there before the update. I'm using gazebo7 and Ubuntu 14.04. The backtrace goes to sdf::getBestSupportedModelVersion.

Log with the backtrace from GDB when running gazebo:

Program received signal SIGSEGV, Segmentation fault.
strlen () at ../sysdeps/x86_64/strlen.S:106
106 ../sysdeps/x86_64/strlen.S: No such file or directory.
(gdb) bt
#0  strlen () at ../sysdeps/x86_64/strlen.S:106
#1  0x00007ffff4eaf485 in sdf::getBestSupportedModelVersion(TiXmlElement*, std::string&) ()
   from /usr/lib/x86_64-linux-gnu/libsdformat.so.4
#2  0x00007ffff4eafaae in sdf::getModelFilePath(std::string const&) () from /usr/lib/x86_64-linux-gnu/libsdformat.so.4
#3  0x00007ffff4eb7a7d in sdf::readXml(TiXmlElement*, std::shared_ptr<sdf::Element>) () from /usr/lib/x86_64-linux-gnu/libsdformat.so.4
#4  0x00007ffff4eb54ec in sdf::readXml(TiXmlElement*, std::shared_ptr<sdf::Element>) () from /usr/lib/x86_64-linux-gnu/libsdformat.so.4
#5  0x00007ffff4eb7ff4 in sdf::readDoc(TiXmlDocument*, std::shared_ptr<sdf::SDF>, std::string const&) ()
   from /usr/lib/x86_64-linux-gnu/libsdformat.so.4
#6  0x00007ffff4eb89d8 in sdf::readFile(std::string const&, std::shared_ptr<sdf::SDF>) () from /usr/lib/x86_64-linux-gnu/libsdformat.so.4
#7  0x00007ffff7baedb4 in gazebo::Server::LoadFile(std::string const&, std::string const&) ()
   from /usr/lib/x86_64-linux-gnu/libgazebo.so.7
#8  0x00007ffff7bb088c in gazebo::Server::ParseArgs(int, char**) () from /usr/lib/x86_64-linux-gnu/libgazebo.so.7
#9  0x00000000004024c9 in ?? ()
#10 0x00007ffff6890f45 in __libc_start_main (main=0x4023e0, argc=10, argv=0x7fffffffc268, init=<optimized out>, fini=<optimized out>, 
    rtld_fini=<optimized out>, stack_end=0x7fffffffc258) at libc-start.c:287
#11 0x0000000000402a38 in _start () 

@scpeters As the author of the related PR: Is this a general bug or might it be a problem specific to me?

osrf-migration commented 7 years ago

Original comment by Dominic Jud (Bitbucket: djud).


This is resolved. The issue was that we had an old definition of a sun where in the model.config we still had <sdf>model.sdf</sdf> causing the seg fault instead of <sdf version="1.5">model.sdf</sdf>.

osrf-migration commented 7 years ago

Original comment by Dominic Jud (Bitbucket: djud).


osrf-migration commented 7 years ago

Original comment by Louise Poubel (Bitbucket: chapulina, GitHub: chapulina).


A similar issue has been posted on Gazebo:

https://bitbucket.org/osrf/gazebo/issues/2238/gzserver-or-gazebo-76-crashes-on-startup

We should try to handle this better so there are no crashes.

osrf-migration commented 7 years ago

Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters).


Let's' add a test case with a malformed model.config to confirm that it doesn't crash.

osrf-migration commented 7 years ago

Original comment by Jose Luis Rivero (Bitbucket: Jose Luis Rivero, GitHub: j-rivero).


osrf-migration commented 7 years ago

Original comment by Jose Luis Rivero (Bitbucket: Jose Luis Rivero, GitHub: j-rivero).


pull request #327, thanks Dominic for the report and the workaround.

My plan is to role a patch version of sdformat4 as soon as we get the PR merged.

osrf-migration commented 7 years ago

Original comment by Jose Luis Rivero (Bitbucket: Jose Luis Rivero, GitHub: j-rivero).


version 4.3.1 is in the repo. Please reopen if the issue still persists for you.