← Back to team overview

yade-users team mailing list archive

Re: [Question #678494]: Segmentation fault (core dumped) O.bodies.append

 

Question #678494 on Yade changed:
https://answers.launchpad.net/yade/+question/678494

    Status: Open => Answered

Janek Kozicki proposed the following answer:
To obtain a useful Backtrace please make sure that you have compiled
yade with -DDEBUG=1, otherwise the backtrace will be useless.

Also on newer linux kernels you might need to run a command:
  echo 0 > /proc/sys/kernel/yama/ptrace_scope ## debug ON

Backtrace:

Successfully delete periodic box!
Successfully generate shear box!
DEBUG yade/pkg/common/InsertionSortCollider.cpp:207 action: Resize bounds containers from 400 to 424, will std::sort.
python: yade/pkg/common/InsertionSortCollider.cpp:223: virtual void InsertionSortCollider::action(): Assertion `(size_t)BB[0].size==2*scene->bodies->size()' failed.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
0x00007fa8ccece67d in poll () at ../sysdeps/unix/syscall-template.S:84
84      ../sysdeps/unix/syscall-template.S: No such file or directory.
Invalid thread ID: info

Thread 24 (Thread 0x7fa878f0a700 (LWP 11503)):
#0  0x00007fa8ccea704a in __GI___waitpid (pid=11509, stat_loc=stat_loc@entry=0x7fa878f091f0, options=options@entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:29
#1  0x00007fa8cce2e0ab in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:148
#2  0x00007fa8cc5e2a1e in crashHandler (sig=6) at yade/core/main/pyboot.cpp:13
#3  <signal handler called>
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#5  0x00007fa8cce2342a in __GI_abort () at abort.c:89
#6  0x00007fa8cce1ae67 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x7fa8cb4e9478 "(size_t)BB[0].size==2*scene->bodies->size()", file=file@entry=0x7fa8cb4e90c8 "yade/pkg/common/InsertionSortCollider.cpp", line=line@entry=223, function=function@entry=0x7fa8cb4f22e0 <InsertionSortCollider::action()::__PRETTY_FUNCTION__> "virtual void InsertionSortCollider::action()") at assert.c:92
#7  0x00007fa8cce1af12 in __GI___assert_fail (assertion=assertion@entry=0x7fa8cb4e9478 "(size_t)BB[0].size==2*scene->bodies->size()", file=file@entry=0x7fa8cb4e90c8 "yade/pkg/common/InsertionSortCollider.cpp", line=line@entry=223, function=function@entry=0x7fa8cb4f22e0 <InsertionSortCollider::action()::__PRETTY_FUNCTION__> "virtual void InsertionSortCollider::action()") at assert.c:101
#8  0x00007fa8ca92e675 in InsertionSortCollider::action (this=0x556bcc023b10) at yade/pkg/common/InsertionSortCollider.cpp:223
#9  0x00007fa8ca458a42 in Scene::moveToNextTimeStep (this=this@entry=0x556bca0c9d30) at yade/core/Scene.cpp:97
#10 0x00007fa8ca45bf47 in SimulationFlow::singleAction (this=0x556bca0c9b10) at yade/core/SimulationFlow.cpp:24
#11 0x00007fa8ca45fa67 in ThreadWorker::callSingleAction (this=0x556bca0c9b10) at yade/core/ThreadWorker.cpp:71
#12 0x00007fa8ca45cb37 in ThreadRunner::call (this=this@entry=0x556bca1c2d30) at yade/core/ThreadRunner.cpp:52
#13 0x00007fa8ca45ce78 in ThreadRunner::run (this=0x556bca1c2d30) at yade/core/ThreadRunner.cpp:26
#14 0x00007fa8ca45eed2 in boost::function0<void>::operator() (this=<optimized out>) at /usr/include/boost/function/function_template.hpp:771
#15 boost::detail::thread_data<boost::function0<void> >::run (this=<optimized out>) at /usr/include/boost/thread/detail/thread.hpp:116
#16 0x00007fa8c7320116 in ?? () from /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.62.0
#17 0x00007fa8cdaba494 in start_thread (arg=0x7fa878f0a700) at pthread_create.c:333
#18 0x00007fa8cced7acf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97


We can see that the problem is in InsertionSortCollider with Assertion `(size_t)BB[0].size==2*scene->bodies->size()'

You might want to try a different collider
https://yade-dev.gitlab.io/trunk/user.html#bo1-functors
https://yade-dev.gitlab.io/trunk/yade.wrapper.html#collider

https://yade-
dev.gitlab.io/trunk/yade.wrapper.html#yade.wrapper.SpatialQuickSortCollider

is suppose to be the safest one.

OTOH, it looks like maybe there is a bug in InsertionSortCollider
because following lines are in contradiction with each other:

 long nBodies=(long)scene->bodies->size();
 ...
 if(BB[0].size!=2*nBodies){
 ... // fix the BB[0].size
 }
 assert((size_t)BB[0].size==2*scene->bodies->size()); // Crash here.

best regards
Janek


Jan Stránský said:     (by the date of Tue, 12 Feb 2019 16:32:29 -0000)

> Question #678494 on Yade changed:
> https://answers.launchpad.net/yade/+question/678494
> 
> Jan Stránský posted a new comment:
> Hello,
> no idea.. for others, output of catchsegv (it seems the problem is around InsertionSortCollider::action)
> Jan
> 
> Backtrace:
> /usr/lib/x86_64-linux-gnu/yade/libyade.so(+0x1f0227b)[0x7f1d31ff627b]
> /usr/lib/x86_64-linux-gnu/libgomp.so.1(GOMP_parallel+0x3f)[0x7f1d294a7ecf]
> /usr/lib/x86_64-linux-gnu/yade/libyade.so(_ZN21InsertionSortCollider6actionEv+0x3e4)[0x7f1d31ff98a4]
> /usr/lib/x86_64-linux-gnu/yade/libyade.so(_ZN5Scene18moveToNextTimeStepEv+0x4b2)[0x7f1d31dba882]
> /usr/lib/x86_64-linux-gnu/yade/libyade.so(_ZN14SimulationFlow12singleActionEv+0x33)[0x7f1d31dbdd83]
> /usr/lib/x86_64-linux-gnu/yade/libyade.so(_ZN12ThreadWorker16callSingleActionEv+0x4f)[0x7f1d31dc179f]
> /usr/lib/x86_64-linux-gnu/yade/libyade.so(_ZN12ThreadRunner4callEv+0x47)[0x7f1d31dbe9b7]
> /usr/lib/x86_64-linux-gnu/yade/libyade.so(_ZN12ThreadRunner3runEv+0x50)[0x7f1d31dbec90]
> /usr/lib/x86_64-linux-gnu/yade/libyade.so(_ZN5boost6detail11thread_dataINS_9function0IvEEE3runEv+0x32)[0x7f1d31dc0d52]
> /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.65.1(+0x11bcd)[0x7f1d2ef7dbcd]
> /lib/x86_64-linux-gnu/libpthread.so.0(+0x76db)[0x7f1d352c56db]
> /lib/x86_64-linux-gnu/libc.so.6(clone+0x3f)[0x7f1d355fe88f]
> 
> -- 
> You received this question notification because your team
> yade-users is an answer contact for Yade.
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to     : yade-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~yade-users
> More help   : https://help.launchpad.net/ListHelp


-- 
Janek Kozicki                               http://janek.kozicki.pl/  |

You received this question notification because your team yade-users is
an answer contact for Yade.