JuliaRobotics / RigidBodyDynamics.jl

Julia implementation of various rigid body dynamics and kinematics algorithms
Other
287 stars 48 forks source link

Segmentation fault #346

Closed phelipe closed 6 years ago

phelipe commented 7 years ago

The simulation function returns

signal (11): Segmentation fault'

Tests performed on two different computers.

tkoolen commented 7 years ago

Could you provide code that exhibits the failure?

phelipe commented 7 years ago

I used the double pendulum example and Acrobot example.

tkoolen commented 7 years ago

Tests pass both locally (on both OSX and Linux) and on Travis, and they include various calls to simulate, as well as running all of the notebooks.

I'll need more to work with. I'm not clear on what code 'the double pendulum example and Acrobot example' exactly refers to. Could you post:

phelipe commented 7 years ago

The tests pass locally here too, however when I run any code calling the simulate function the error happens. An example code I used follows below, but I also tested using https://github.com/tkoolen/RoboticsJuliaCon2017.jl/tree/master/notebook

using RigidBodyDynamics

urdf = "urdf/doublependulum.urdf"
mechanism = parse_urdf(Float64, urdf)
state = MechanismState{Float64}( mechanism)
times, joint_angles, joint_velocities = simulate(state, 5.)
julia> Pkg.status("RigidBodyDynamics")
 - RigidBodyDynamics             0.4.0+             master
julia> versioninfo()
Julia Version 0.6.0                                              
Commit 903644385b* (2017-06-19 13:05 UTC)                        
Platform Info:                                                   
  OS: Linux (x86_64-pc-linux-gnu)                                
  CPU: Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz                  
  WORD_SIZE: 64                                                  
  BLAS: libblas                                                  
  LAPACK: liblapack                                              
  LIBM: libm                                                     
  LLVM: libLLVM-3.9.1 (ORCJIT, haswell)
julia> Pkg.status()
11 required packages:
- ControlSystems                0.3.0
- DrakeVisualizer               0.2.1+             master
- ForwardDiff                   0.5.0
- Gurobi                        0.3.3
- JuMP                          0.18.0
- LCMCore                       0.0.4              85a57d79 (dirty)
- ODE                           0.7.0
- PyPlot                        2.3.2
- RigidBodyDynamics             0.4.0+             master
- RigidBodyTreeInspector        0.3.2              master
- SymPy                         0.5.3
64 additional packages:
- AxisAlgorithms                0.2.0
- BaseTestNext                  0.2.2
- BinDeps                       0.6.0
- CMakeWrapper                  0.0.2
- Calculus                      0.2.2
- ColorTypes                    0.6.3
- Colors                        0.8.1
- CommonSubexpressions          0.0.1
- Compat                        0.32.0
- Conda                         0.7.0
- Contour                       0.4.0
- CoordinateTransformations     0.4.1
- DataStructures                0.7.2
- DiffBase                      0.2.0
- DiffEqBase                    1.23.1
- DocStringExtensions           0.4.1
- DualNumbers                   0.3.0
- FileIO                        0.5.2
- FixedPointNumbers             0.4.1
- GeometryTypes                 0.4.2
- Hiccup                        0.1.1
- IJulia                        1.6.1
- Interact                      0.6.2
- Interpolations                0.7.0
- IterTools                     0.1.0
- JSON                          0.14.0
- Juno                          0.3.1
- LaTeXStrings                  0.2.1
- LightXML                      0.5.0
- LinearMaps                    1.0.1
- MacroTools                    0.3.7
- MathProgBase                  0.6.4
- MbedTLS                       0.5.0
- Measures                      0.1.0
- Media                         0.3.0
- MeshIO                        0.1.0
- Meshing                       0.2.0
- NaNMath                       0.2.6
- Parameters                    0.7.3
- PlotThemes                    0.1.4
- PlotUtils                     0.4.4
- Plots                         0.12.4
- Polynomials                   0.1.6
- PyCall                        1.15.0
- Ratios                        0.2.0
- Reactive                      0.6.0
- RealInterface                 0.0.3
- RecipesBase                   0.2.2
- RecursiveArrayTools           0.12.3
- Reexport                      0.0.3
- Requires                      0.4.3
- ReverseDiffSparse             0.8.0
- Rotations                     0.6.0
- SHA                           0.5.1
- ShowItLikeYouBuildIt          0.1.1
- Showoff                       0.1.1
- SimpleTraits                  0.5.1
- SpecialFunctions              0.3.3
- StaticArrays                  0.6.2
- StatsBase                     0.19.0
- TypeSortedCollections         0.1.1
- URIParser                     0.2.0
- WoodburyMatrices              0.2.2
- ZMQ                           0.4.3
signal (11): Segmentation fault
while loading no file, in expression starting on line 0
_ZN4llvm17ScheduleDAGMILive19updatePressureDiffsENS_8ArrayRefINS_16RegisterMaskPairEEE at /usr/bin/../lib/libLLVM-3.9.so (unknown line)
_ZN4llvm17ScheduleDAGMILive10scheduleMIEPNS_5SUnitEb at /usr/bin/../lib/libLLVM-3.9.so (unknown line)
_ZN4llvm17ScheduleDAGMILive8scheduleEv at /usr/bin/../lib/libLLVM-3.9.so (unknown line)
unknown function (ip: 0x7fc9909d460c)
unknown function (ip: 0x7fc9909de680)
_ZN4llvm19MachineFunctionPass13runOnFunctionERNS_8FunctionE at /usr/bin/../lib/libLLVM-3.9.so (unknown line)
_ZN4llvm13FPPassManager13runOnFunctionERNS_8FunctionE at /usr/bin/../lib/libLLVM-3.9.so (unknown line)
_ZN4llvm13FPPassManager11runOnModuleERNS_6ModuleE at /usr/bin/../lib/libLLVM-3.9.so (unknown line)
_ZN4llvm6legacy15PassManagerImpl3runERNS_6ModuleE at /usr/bin/../lib/libLLVM-3.9.so (unknown line)
unknown function (ip: 0x7fc993b6a99d)
unknown function (ip: 0x7fc993b7034f)
unknown function (ip: 0x7fc993b70e27)
unknown function (ip: 0x7fc993b239b1)
unknown function (ip: 0x7fc993b60c07)
jl_apply_generic at /usr/bin/../lib/libjulia.so.0.6 (unknown line)
#simulate#145 at /home/phelipe/.julia/v0.6/RigidBodyDynamics/src/simulate.jl:48
unknown function (ip: 0x7fc97f6d7c39)
jl_apply_generic at /usr/bin/../lib/libjulia.so.0.6 (unknown line)
jl_invoke at /usr/bin/../lib/libjulia.so.0.6 (unknown line)
simulate at /home/phelipe/.julia/v0.6/RigidBodyDynamics/src/simulate.jl:35
unknown function (ip: 0x7fc97f6d78ea)
jl_apply_generic at /usr/bin/../lib/libjulia.so.0.6 (unknown line)
unknown function (ip: 0x7fc993ad351f)
unknown function (ip: 0x7fc993ad264e)
unknown function (ip: 0x7fc993ad3d28)
unknown function (ip: 0x7fc993ad44a8)
unknown function (ip: 0x7fc993aea945)
jl_toplevel_eval_in at /usr/bin/../lib/libjulia.so.0.6 (unknown line)
unknown function (ip: 0x7fc98c33e6f9)
unknown function (ip: 0x7fc98c33e70f)
jl_apply_generic at /usr/bin/../lib/libjulia.so.0.6 (unknown line)
unknown function (ip: 0x7fc98c3ac321)
unknown function (ip: 0x7fc98c3ac53f)
jl_apply_generic at /usr/bin/../lib/libjulia.so.0.6 (unknown line)
macro expansion at ./REPL.jl:97 [inlined]
#1 at ./event.jl:73
unknown function (ip: 0x7fc97f6582af)
jl_apply_generic at /usr/bin/../lib/libjulia.so.0.6 (unknown line)
unknown function (ip: 0x7fc993ad8839)
unknown function (ip: 0xffffffffffffffff)
Allocations: 22342254 (Pool: 22339872; Big: 2382); GC: 36
tkoolen commented 6 years ago

Hmm, I still can't reproduce this, neither on OSX nor on Linux. To be clear, I'm on RigidBodyDynamics 0371c566f977ad1b01a173e7a6c602d0e80d2e95, and I did change "urdf/doublependulum.urdf" in your example code to "urdf/Acrobot.urdf" because I don't have a "doublependulum.urdf". But you mentioned that the same thing happens with "Acrobot.urdf".

I noticed in your versioninfo that you're using

  BLAS: libblas                                                  
  LAPACK: liblapack                                              
  LIBM: libm   

whereas I have

  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas64_
  LIBM: libopenlibm

Also, your commit is 903644385b*, whereas mine is 9036443 (no star). I'm assuming the star means local modifications that weren't committed, and that you compiled Julia from source. Could you try with the generic Linux binary downloaded from the Julia website?

By the way, the stack trace appears to be similar to https://github.com/JuliaLang/julia/issues/21244.

For completeness, here is my test setup on Linux:

julia> Pkg.status()
1 required packages:
 - RigidBodyDynamics             0.4.0+             master
7 additional packages:
 - Compat                        0.32.0
 - DocStringExtensions           0.4.1
 - LightXML                      0.5.0
 - Reexport                      0.0.3
 - Rotations                     0.6.0
 - StaticArrays                  0.6.2
 - TypeSortedCollections         0.1.1

(same dependency versions as you were using)

julia> versioninfo()
Julia Version 0.6.0
Commit 9036443 (2017-06-19 13:05 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-6950X CPU @ 3.00GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.9.1 (ORCJIT, broadwell)
phelipe commented 6 years ago

Hi It really is not a problem with the package itself, it's a problem with LLVM https://github.com/JuliaLang/julia/issues/19792.

Thank you! :D

tkoolen commented 6 years ago

Thank you very much for the update. Just so that I understand fully, was this because you compiled Julia against a vanilla version of LLVM that didn't include the patches from https://github.com/JuliaLang/julia/pull/19810?

phelipe commented 6 years ago

I use Manjaro (based on Arch linux), julia is in the package manager of it. However since the Arch is rolling-release system, the error may have occurred after a system update. Some people reported that same problem on Slack, including problems similar to the ones I had when I installed DrakeVisualizer.