bulletphysics / bullet3

Bullet Physics SDK: real-time collision detection and multi-physics simulation for VR, games, visual effects, robotics, machine learning etc.
http://bulletphysics.org
Other
12.5k stars 2.87k forks source link

App_robotSimulator crash with "btSpinMutex::lock(): Assertion `!"unimplemented btSpinMutex::lock() called"' failed in debug mode." #2023

Closed eastskykang closed 5 years ago

eastskykang commented 5 years ago

Hello,

As I run App_RobotSimulator with cmake debug mode, I got the following error.

startThreads creating 1 threads.
starting thread 0
started thread 0 
argc=2
argv[0] = --unused
argv[1] = --start_demo_name=Physics Server
ExampleBrowserThreadFunc started
X11 functions dynamically loaded using dlopen/dlsym OK!
X11 functions dynamically loaded using dlopen/dlsym OK!
Creating context
Created GL 3.3 context
Direct GLX rendering context obtained
Making context current
GL_VENDOR=Intel Open Source Technology Center
GL_RENDERER=Mesa DRI Intel(R) HD Graphics 630 (Kaby Lake GT2) 
GL_VERSION=4.5 (Core Profile) Mesa 18.0.5
GL_SHADING_LANGUAGE_VERSION=4.50
pthread_getconcurrency()=0
Version = 4.5 (Core Profile) Mesa 18.0.5
Vendor = Intel Open Source Technology Center
Renderer = Mesa DRI Intel(R) HD Graphics 630 (Kaby Lake GT2) 
b3Printf: Selected demo: Physics Server
startThreads creating 1 threads.
starting thread 0
started thread 0 
MotionThreadFunc thread started
ven = Intel Open Source Technology Center
Workaround for some crash in the Intel OpenGL driver on Linux/Ubuntu
App_RobotSimulator_d: /home/donghok/git/bullet3/src/LinearMath/btThreads.cpp:198: void btSpinMutex::lock(): Assertion `!"unimplemented btSpinMutex::lock() called"' failed.

Process finished with exit code 134 (interrupted by signal 6: SIGABRT)

Someone can give some suggestion to fix it?

Thank you.

erwincoumans commented 5 years ago

How did you build the exe? cmake or premake? If one, can you try the other?

What OS and compiler?

AlCap23 commented 5 years ago

I have a similar error while loading a urdf using the b3RobotSimulatorClientAPI_noGUI .

I pretty much copied the code from the example library.

    model = new b3RobotSimulatorClientAPI_NoGUI();
    connected = model->connect(eCONNECT_DIRECT);
    if (!connected)
    {
        std::cerr << "Error: Could not connect to bullet server..." << std::endl;
        abort();
    }

    // Config for bullet
    //model->configureDebugVisualizer(COV_ENABLE_GUI, 0);
    model->setTimeOut(10);
    model->syncBodies();

    // Set the time step
    btScalar bStepSize = 1. / 240.;
    model->setTimeStep(bStepSize);
    // Convert the gravity
    btVector3 bGravity = btVector3(0, 0, 0);
    //for (int i = 0; i < 3; i++)
    //{
    //    bGravity[i] = modelConfig["gravity"][i].as<double>();
    //}
    model->setGravity(bGravity);
    std::cout << "Working until load URDF" << std::endl;
    // load the urdf
    model->loadURDF(modelFile);
    //for (int i = 0; i < 100; i++)
    //{
    //    model->stepSimulation();
    //}
    std::cout << "Working after load URDF" << std::endl;

Which leads to the following output

Working until load URDF
dynamics_benchmark:BULLET_INSTALL/bullet/src/LinearMath/btThreads.cpp:198: void btSpinMutex::lock(): Assertion `!"unimplemented btSpinMutex::lock() called"' failed.
Aborted (core dumped)

Running gdb gives:

Working until load URDF
dynamics_benchmark: /media/jmartensen/Data/general/research/01_benchmark/external/bullet/src/LinearMath/btThreads.cpp:198: void btSpinMutex::lock(): Assertion `!"unimplemented btSpinMutex::lock() called"' failed.

Program received signal SIGABRT, Aborted.
0x00007ffff5c89428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
54  ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) quit()
A debugging session is active.

I am using cmake ( C++11) , Ubuntu 16.04.

erwincoumans commented 5 years ago

It is a harmless warning if using Bullet in a single-threaded environment (DIRECT mode /NO_GUI). It is fixed here: https://github.com/bulletphysics/bullet3/pull/2030/commits/fb2baa81d67c16e42cc0eec56af08192b12e14fb

If you use Bullet, BulletRobotics or PyBullet in multithreaded mode (GUI, SHARED_MEMORY etc), can you use premake to build the project and make sure to enable_multithreading?

premake4  --double --enable_multithreading  --targetdir="../bin" vs2010 

When using cmake, please use BULLET2_MULTITHREADING=ON