Segfault when rapidly creating/destroying worlds

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Re: Segfault when rapidly creating/destroying worlds

Postby d.l.i.w » Wed Feb 22, 2017 9:23 am

oliver wrote:Can you run the tiny Newton program from my first post on this thread and tell us if it segfaults on your system, please?


I just did with the latest git master and I (sometimes) get this:

Code: Select all
terminate called without an active exception
[Thread 0x7ffff6ba3700 (LWP 31404) exited]
pure virtual method called
terminate called recursively

Thread 1 "a.out" received signal SIGABRT, Aborted.
0x00007ffff768c8d7 in raise () from /lib64/libc.so.6
(gdb) backtrace
#0  0x00007ffff768c8d7 in raise () from /lib64/libc.so.6
#1  0x00007ffff768dcaa in abort () from /lib64/libc.so.6
#2  0x00007ffff736b87d in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib64/libstdc++.so.6
#3  0x00007ffff7369906 in ?? () from /usr/lib64/libstdc++.so.6
#4  0x00007ffff7369951 in std::terminate() () from /usr/lib64/libstdc++.so.6
#5  0x00007ffff7aa917d in std::thread::~thread (this=<optimized out>, __in_chrg=<optimized out>) at /usr/include/c++/4.8/thread:143
#6  dgThread::~dgThread (this=<optimized out>, __in_chrg=<optimized out>) at /coreLibrary_300/source/core/dgThread.cpp:130
#7  0x00007ffff7b60e6c in dgWorld::~dgWorld (this=0x617e40, __in_chrg=<optimized out>) at /coreLibrary_300/source/physics/dgWorld.cpp:315
#8  0x00007ffff7b9f8f9 in Newton::~Newton (this=0x617e40, __in_chrg=<optimized out>) at /coreLibrary_300/source/newton/NewtonClass.cpp:49
#9  0x00007ffff7b95a7e in NewtonDestroy (newtonWorld=<optimized out>) at /coreLibrary_300/source/newton/Newton.cpp:205
#10 0x000000000040069b in main ()



Btw. tested on openSUSE 42.2 with gcc 4.8.5


EDIT:
@julio I cannot find DG_USE_PTHREADS in the source code any more. Is this define obsolete? If so, I will create a pull request to remove this option from CMake.
d.l.i.w
 
Posts: 81
Joined: Mon Sep 26, 2011 4:35 am

Re: Segfault when rapidly creating/destroying worlds

Postby Julio Jerez » Wed Feb 22, 2017 10:16 am

since we move to c++ 11 standard thread the engine no longer use pthread
I did a global search for DG_USE_PTHREADS in the entire folder, and I do no find it, where is that define at?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Segfault when rapidly creating/destroying worlds

Postby d.l.i.w » Wed Feb 22, 2017 10:39 am

It's still in the CMake project files:
https://github.com/MADEAPPS/newton-dynamics/blob/master/CMakeLists.txt#L99

Please merge the pull request to remove this option.


Also many of the Visual Studio project files reference the non-existing folder pthreads.2, time for cleanup :wink:

Code: Select all
packages/projects/visualStudio_2010_dll/dAnimation.vcxproj:    <ProjectReference Include="..\..\..\coreLibrary_300\source\pthreads.2\VS_2010_static_mt\pthread.vcxproj">
packages/projects/visualStudio_2013_static_mt/build.sln:Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pthread", "..\..\..\coreLibrary_300\source\pthreads.2\VS_2013_static_mt\pthread.vcxproj", "{03BCA23C-02A5-415B-A37B-26600BC2CE96}"
coreLibrary_300/projects/windows/project_vs2015_static_mt/physics.vcxproj:      <AdditionalIncludeDirectories>../../../source/core;../../../source/physics;../../../source/meshUtil;../../../source/pthreads.2;../../../source/ampPhysics;../../../../packages/thirdParty/timeTracker</AdditionalIncludeDirectories>
coreLibrary_300/projects/windows/project_vs2015_static_mt/physics.vcxproj:      <AdditionalIncludeDirectories>../../../source/core;../../../source/physics;../../../source/meshUtil;../../../source/pthreads.2;../../../source/ampPhysics;../../../../packages/thirdParty/timeTracker</AdditionalIncludeDirectories>
coreLibrary_300/projects/windows/project_vs2015_static_mt/physics.vcxproj:      <AdditionalIncludeDirectories>../../../source/core;../../../source/physics;../../../source/meshUtil;../../../source/pthreads.2;../../../source/ampPhysics;../../../../packages/thirdParty/timeTracker</AdditionalIncludeDirectories>
coreLibrary_300/projects/windows/project_vs2015_static_mt/physics.vcxproj:      <AdditionalIncludeDirectories>../../../source/core;../../../source/physics;../../../source/meshUtil;../../../source/pthreads.2;../../../source/ampPhysics;../../../../packages/thirdParty/timeTracker</AdditionalIncludeDirectories>
applications/maxPlugin/projects/VS2008/maxPlugin.sln:Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pthread", "..\..\..\..\coreLibrary_300\source\pthreads.2\VS_2008_static_md\pthread.vcproj", "{03BCA23C-02A5-415B-A37B-26600BC2CE96}"
applications/maxPlugin/projects/VS2010/maxPlugin.vcxproj:    <ProjectReference Include="..\..\..\..\coreLibrary_300\source\pthreads.2\VS_2010_static_mt\pthread.vcxproj">
applications/maxPlugin/projects/VS2010/maxPlugin.sln:Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pthread", "..\..\..\..\coreLibrary_300\source\pthreads.2\VS_2010_static_mt\pthread.vcxproj", "{03BCA23C-02A5-415B-A37B-26600BC2CE96}"
applications/tutorialsSDK300/CNewtonTutorials/newtonTutorials.sln:Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pthread", "..\..\..\coreLibrary_300\source\pthreads.2\VS_2010_static_md\pthread.vcxproj", "{03BCA23C-02A5-415B-A37B-26600BC2CE96}"
applications/tutorialsSDK300/CNewtonTutorials/tutorial_101_GettingStarted/tutorial_101_GettingStarted.vcxproj:    <ProjectReference Include="..\..\..\..\coreLibrary_300\source\pthreads.2\VS_2010_static_md\pthread.vcxproj">
applications/tutorialsSDK300/CNewtonTutorials/tutorial_202_VehicleController/tutorial_102_VehicleControllerDll.vcxproj:    <ProjectReference Include="..\..\..\..\coreLibrary_300\source\pthreads.2\VS_2010_static_md\pthread.vcxproj">
applications/tutorialsSDK300/CNewtonTutorials/tutorial_202_VehicleController/tutorial_102_VehicleController.vcxproj:    <ProjectReference Include="..\..\..\..\coreLibrary_300\source\pthreads.2\VS_2010_static_md\pthread.vcxproj">
applications/tutorialsSDK300/CNewtonTutorials/tutorial_201_PlayerController/tutorial_101_PlayerController.vcxproj:    <ProjectReference Include="..\..\..\..\coreLibrary_300\source\pthreads.2\VS_2010_static_md\pthread.vcxproj">
applications/tutorialsSDK300/NewtonTutorials/newtonTutorials.sln:Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pthread", "..\..\..\coreLibrary_300\source\pthreads.2\VS_2010_static_md\pthread.vcxproj", "{03BCA23C-02A5-415B-A37B-26600BC2CE96}"
applications/tutorialsSDK300/NewtonTutorials/tutorial_101_GettingStarted/tutorial_101_GettingStarted.vcxproj:    <ProjectReference Include="..\..\..\..\coreLibrary_300\source\pthreads.2\VS_2010_static_md\pthread.vcxproj">
applications/demosSandbox/projects/visualStudio_2010_imgui/demosSandbox.sln:Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pthread", "..\..\..\..\coreLibrary_300\source\pthreads.2\VS_2010\pthread.vcxproj", "{03BCA23C-02A5-415B-A37B-26600BC2CE96}"
applications/demosSandbox/projects/visualStudio_2010_imgui/demosSandbox.vcxproj:    <ProjectReference Include="..\..\..\..\coreLibrary_300\source\pthreads.2\VS_2010\pthread.vcxproj">
applications/modelEditor/addInPlugins/projects_vs2010/dCollada.vcxproj:    <ProjectReference Include="..\..\..\..\coreLibrary_300\source\pthreads.2\VS_2010_static_mt\pthread.vcxproj">
applications/modelEditor/addInPlugins/projects_vs2010/AddInSolution.sln:Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pthread", "..\..\..\..\coreLibrary_300\source\pthreads.2\VS_2010_static_mt\pthread.vcxproj", "{03BCA23C-02A5-415B-A37B-26600BC2CE96}"
applications/modelEditor/projects/visualStudio_2010/nme.vcxproj:    <ProjectReference Include="..\..\..\..\coreLibrary_300\source\pthreads.2\VS_2010_static_mt\pthread.vcxproj">
applications/modelEditor/projects/visualStudio_2010/nme.sln:Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pthread", "..\..\..\..\coreLibrary_300\source\pthreads.2\VS_2010_static_mt\pthread.vcxproj", "{03BCA23C-02A5-415B-A37B-26600BC2CE96}"
applications/tutorialsSDK200/NewtonTutorials.sln:Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pthread", "..\..\packages\thirdParty\pthreads.2\pthread.vcproj", "{03BCA23C-02A5-415B-A37B-26600BC2CE96}"


I cannot attach text files, so please copy the above into a text editor, otherwise it's very hard to read...


And back to topic: I also get an segfault with the test program posted above:
Backtrace
d.l.i.w
 
Posts: 81
Joined: Mon Sep 26, 2011 4:35 am

Re: Segfault when rapidly creating/destroying worlds

Postby Julio Jerez » Wed Feb 22, 2017 12:02 pm

Ok I think I removed all references to pthread by the sdk.
there is only one left in a cmake file:
C:\Development\newton-dynamics\CMakeLists.txt
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Segfault when rapidly creating/destroying worlds

Postby d.l.i.w » Wed Feb 22, 2017 12:10 pm

Do you mean this line?
Code: Select all
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread")


This is ok and needed for std:thread on Linux: http://stackoverflow.com/a/8649908
d.l.i.w
 
Posts: 81
Joined: Mon Sep 26, 2011 4:35 am

Previous

Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 7 guests