GenGeo module crashes when imported in yade (not in pure python)

Bug #528509 reported by Anton Gladky
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Yade
Fix Released
Undecided
Unassigned

Bug Description

It seems, that the function packer.generatePacking () calls a crash.

.....
InsertGenerator3D::seedParticles
bbx: -25 -25 -25 - 25 25 225
SIGSEGV/SIGABRT handler called; gdb batch file is `/tmp/yade-7ZdmxQ/tmp-0'
GNU gdb (GDB) 7.0-ubuntu
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
[Thread debugging using libthread_db enabled]
[New Thread 0x7fe71a8e4910 (LWP 30782)]
[New Thread 0x7fe71c1c4910 (LWP 30781)]
[New Thread 0x7fe71c9c5910 (LWP 30780)]
0x00007fe73308db4d in __libc_waitpid (pid=30783, stat_loc=<value optimized out>,
    options=0) at ../sysdeps/unix/sysv/linux/waitpid.c:41
41 ../sysdeps/unix/sysv/linux/waitpid.c: No such file or directory.
 in ../sysdeps/unix/sysv/linux/waitpid.c
No symbol "info" in current context.

Thread 4 (Thread 0x7fe71c9c5910 (LWP 30780)):
#0 sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:85
#1 0x00000000004cd598 in PyThread_acquire_lock (lock=0x23f3710, waitflag=128) at ../Python/thread_pthread.h:349
#2 0x000000000049c85a in PyEval_AcquireThread (tstate=0x2b41c50) at ../Python/ceval.c:253
#3 0x00000000004d0bdc in t_bootstrap (boot_raw=0x2a86e20) at ../Modules/threadmodule.c:424
#4 0x00007fe733c01a04 in start_thread (arg=<value optimized out>) at pthread_create.c:300
#5 0x00007fe7330c980d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#6 0x0000000000000000 in ?? ()

Related branches

Revision history for this message
Anton Gladky (gladky-anton) wrote :
Revision history for this message
Václav Šmilauer (eudoxos) wrote :

This bug should be assigned to esys-particle, right? Please change if appropriate.

Revision history for this message
Anton Gladky (gladky-anton) wrote : Re: [Bug 528509] Re: genCylLSM.py calls a crash

No,
It happens only when packer.generatePacking () is called inside YADE. The
same script, started separately works fine.
______________________________

Anton Gladkyy

2010/2/26 Václav Šmilauer <email address hidden>

> This bug should be assigned to esys-particle, right? Please change if
> appropriate.
>
> --
> genCylLSM.py calls a crash
> https://bugs.launchpad.net/bugs/528509
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in Yet Another Dynamic Engine: New
>
> Bug description:
> It seems, that the function packer.generatePacking () calls a crash.
>
> .....
> InsertGenerator3D::seedParticles
> bbx: -25 -25 -25 - 25 25 225
> SIGSEGV/SIGABRT handler called; gdb batch file is `/tmp/yade-7ZdmxQ/tmp-0'
> GNU gdb (GDB) 7.0-ubuntu
> Copyright (C) 2009 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <
> http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law. Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "x86_64-linux-gnu".
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>.
> [Thread debugging using libthread_db enabled]
> [New Thread 0x7fe71a8e4910 (LWP 30782)]
> [New Thread 0x7fe71c1c4910 (LWP 30781)]
> [New Thread 0x7fe71c9c5910 (LWP 30780)]
> 0x00007fe73308db4d in __libc_waitpid (pid=30783, stat_loc=<value optimized
> out>,
> options=0) at ../sysdeps/unix/sysv/linux/waitpid.c:41
> 41 ../sysdeps/unix/sysv/linux/waitpid.c: No such file or directory.
> in ../sysdeps/unix/sysv/linux/waitpid.c
> No symbol "info" in current context.
>
> Thread 4 (Thread 0x7fe71c9c5910 (LWP 30780)):
> #0 sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:85
> #1 0x00000000004cd598 in PyThread_acquire_lock (lock=0x23f3710,
> waitflag=128) at ../Python/thread_pthread.h:349
> #2 0x000000000049c85a in PyEval_AcquireThread (tstate=0x2b41c50) at
> ../Python/ceval.c:253
> #3 0x00000000004d0bdc in t_bootstrap (boot_raw=0x2a86e20) at
> ../Modules/threadmodule.c:424
> #4 0x00007fe733c01a04 in start_thread (arg=<value optimized out>) at
> pthread_create.c:300
> #5 0x00007fe7330c980d in clone () at
> ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
> #6 0x0000000000000000 in ?? ()
>
> To unsubscribe from this bug, go to:
> https://bugs.launchpad.net/yade/+bug/528509/+subscribe
>

Revision history for this message
Václav Šmilauer (eudoxos) wrote : Re: genCylLSM.py calls a crash

The crash is clearly in esys-particle code. Not yade problem:

#4 <signal handler called>
#5 0x0000000000000016 in ?? ()
#6 0x00007fe718f6c30f in MNTCell::getSpheresFromGroupNear (this=0x2d0eda8, P=..., d=3.2252605360516574e-319, gid=<value optimized out>) at ../src/MNTCell.cc:119

Revision history for this message
Václav Šmilauer (eudoxos) wrote :

This could come from the fact that esys-particle is compiled with MPI, therefore cannot be run with plain python inrepreter as yade does...?

Revision history for this message
Václav Šmilauer (eudoxos) wrote :

Ok, sorry, I just checked and GenGeo is compiled with plain g++ separately. And yes, I also have that crash... Trying to get more debugging info, and will perhaps ask esys folks.

Revision history for this message
Anton Gladky (gladky-anton) wrote : Re: [Bug 528509] Re: genCylLSM.py calls a crash

No. LSMGenGeo is the separate library, it compiles and installs separately.
______________________________

Anton Gladkyy

2010/4/14 Václav Šmilauer <email address hidden>

> This could come from the fact that esys-particle is compiled with MPI,
> therefore cannot be run with plain python inrepreter as yade does...?
>
> --
> genCylLSM.py calls a crash
> https://bugs.launchpad.net/bugs/528509
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in Yet Another Dynamic Engine: New
>
> Bug description:
> It seems, that the function packer.generatePacking () calls a crash.
>
> .....
> InsertGenerator3D::seedParticles
> bbx: -25 -25 -25 - 25 25 225
> SIGSEGV/SIGABRT handler called; gdb batch file is `/tmp/yade-7ZdmxQ/tmp-0'
> GNU gdb (GDB) 7.0-ubuntu
> Copyright (C) 2009 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <
> http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law. Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "x86_64-linux-gnu".
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>.
> [Thread debugging using libthread_db enabled]
> [New Thread 0x7fe71a8e4910 (LWP 30782)]
> [New Thread 0x7fe71c1c4910 (LWP 30781)]
> [New Thread 0x7fe71c9c5910 (LWP 30780)]
> 0x00007fe73308db4d in __libc_waitpid (pid=30783, stat_loc=<value optimized
> out>,
> options=0) at ../sysdeps/unix/sysv/linux/waitpid.c:41
> 41 ../sysdeps/unix/sysv/linux/waitpid.c: No such file or directory.
> in ../sysdeps/unix/sysv/linux/waitpid.c
> No symbol "info" in current context.
>
> Thread 4 (Thread 0x7fe71c9c5910 (LWP 30780)):
> #0 sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:85
> #1 0x00000000004cd598 in PyThread_acquire_lock (lock=0x23f3710,
> waitflag=128) at ../Python/thread_pthread.h:349
> #2 0x000000000049c85a in PyEval_AcquireThread (tstate=0x2b41c50) at
> ../Python/ceval.c:253
> #3 0x00000000004d0bdc in t_bootstrap (boot_raw=0x2a86e20) at
> ../Modules/threadmodule.c:424
> #4 0x00007fe733c01a04 in start_thread (arg=<value optimized out>) at
> pthread_create.c:300
> #5 0x00007fe7330c980d in clone () at
> ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
> #6 0x0000000000000000 in ?? ()
>
> To unsubscribe from this bug, go to:
> https://bugs.launchpad.net/yade/+bug/528509/+subscribe
>

Revision history for this message
Anton Gladky (gladky-anton) wrote :

The problem is that it worked normally with old yade-cxx binary, but it does
not with current yade-python-starter.

2010/4/14 Anton Gladky <email address hidden>

> No. LSMGenGeo is the separate library, it compiles and installs separately.
>
> ______________________________
>
>
> Anton Gladkyy
>
>
> 2010/4/14 Václav Šmilauer <email address hidden>
>
> This could come from the fact that esys-particle is compiled with MPI,
>> therefore cannot be run with plain python inrepreter as yade does...?
>>
>> --
>> genCylLSM.py calls a crash
>> https://bugs.launchpad.net/bugs/528509
>> You received this bug notification because you are a direct subscriber
>> of the bug.
>>
>> Status in Yet Another Dynamic Engine: New
>>
>> Bug description:
>> It seems, that the function packer.generatePacking () calls a crash.
>>
>> .....
>> InsertGenerator3D::seedParticles
>> bbx: -25 -25 -25 - 25 25 225
>> SIGSEGV/SIGABRT handler called; gdb batch file is `/tmp/yade-7ZdmxQ/tmp-0'
>> GNU gdb (GDB) 7.0-ubuntu
>> Copyright (C) 2009 Free Software Foundation, Inc.
>> License GPLv3+: GNU GPL version 3 or later <
>> http://gnu.org/licenses/gpl.html>
>> This is free software: you are free to change and redistribute it.
>> There is NO WARRANTY, to the extent permitted by law. Type "show copying"
>> and "show warranty" for details.
>> This GDB was configured as "x86_64-linux-gnu".
>> For bug reporting instructions, please see:
>> <http://www.gnu.org/software/gdb/bugs/>.
>> [Thread debugging using libthread_db enabled]
>> [New Thread 0x7fe71a8e4910 (LWP 30782)]
>> [New Thread 0x7fe71c1c4910 (LWP 30781)]
>> [New Thread 0x7fe71c9c5910 (LWP 30780)]
>> 0x00007fe73308db4d in __libc_waitpid (pid=30783, stat_loc=<value optimized
>> out>,
>> options=0) at ../sysdeps/unix/sysv/linux/waitpid.c:41
>> 41 ../sysdeps/unix/sysv/linux/waitpid.c: No such file or directory.
>> in ../sysdeps/unix/sysv/linux/waitpid.c
>> No symbol "info" in current context.
>>
>> Thread 4 (Thread 0x7fe71c9c5910 (LWP 30780)):
>> #0 sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:85
>> #1 0x00000000004cd598 in PyThread_acquire_lock (lock=0x23f3710,
>> waitflag=128) at ../Python/thread_pthread.h:349
>> #2 0x000000000049c85a in PyEval_AcquireThread (tstate=0x2b41c50) at
>> ../Python/ceval.c:253
>> #3 0x00000000004d0bdc in t_bootstrap (boot_raw=0x2a86e20) at
>> ../Modules/threadmodule.c:424
>> #4 0x00007fe733c01a04 in start_thread (arg=<value optimized out>) at
>> pthread_create.c:300
>> #5 0x00007fe7330c980d in clone () at
>> ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
>> #6 0x0000000000000000 in ?? ()
>>
>> To unsubscribe from this bug, go to:
>> https://bugs.launchpad.net/yade/+bug/528509/+subscribe
>>
>
>

Revision history for this message
Václav Šmilauer (eudoxos) wrote : Re: genCylLSM.py calls a crash

Ok, I found the cause by compiling without optimization:

#4 <signal handler called>
#5 0x00007f4ec5c0e800 in std::_List_base<boost::shared_ptr<Archive>, std::allocator<boost::shared_ptr<Archive> > >::_M_clear (this=0x7fffcde8adb8) at /usr/include/c++/4.4/bits/list.tcc:72
#6 0x00007f4ec5be0af1 in ~_List_base (this=0x7fffcde8adb8, __in_chrg=<value optimized out>) at /usr/include/c++/4.4/bits/stl_list.h:360
#7 0x00007f4ec5bbbb08 in ~list (this=0x7fffcde8adb8, __in_chrg=<value optimized out>) at /usr/include/c++/4.4/bits/stl_list.h:418
#8 0x00007f4ec5bbbc0b in ~Serializable (this=0x7fffcde8adb0, __in_chrg=<value optimized out>) at /home/vaclav/yade/build-trunk-dbg/include/yade-trunk/yade/lib-serialization/Serializable.hpp:261
#9 0x00007f4ec5bb2ad8 in ~Shape (this=0x7fffcde8adb0, __in_chrg=<value optimized out>) at /home/vaclav/yade/trunk/core/Shape.cpp:2
#10 0x00007f4eb614c6e2 in ~Sphere (this=0x7fffcde8adb0, __in_chrg=<value optimized out>) at pkg/common/DataClass/Shape/Sphere.cpp:13
#11 0x00007f4ea43ea258 in InsertGenerator3D::seedParticles (this=0x327bee0, vol=0x313daa0, ntable=0x313dbb0, gid=0, tag=0) at ../src/InsertGenerator3D.cc:200
[...]

Now relevant part of code at InsertGenerator3D.cc is

     Sphere S(Vec3(px,py,pz),r);
     /* stuff that is not important */
     // line 200 is here
}

It means that the crash happens (line 200) when scope is being left. Destructor for the S object (of type Sphere) is called. But:

  #10 0x00007f4eb614c6e2 in ~Sphere (this=0x7fffcde8adb0, __in_chrg=<value optimized out>) at pkg/common/DataClass/Shape/Sphere.cpp:13

Dtor of _yade's_ Sphere is called instead, leading obviously to crash!

There seems to be no way to avoid that, as we have to load libs with RTLD_GLOBAL (see py/__init__.py.in for comment on that); that also means that even if new module (gengeo) is loaded, already existing symbol for ~Sphere will be used.

Proper solution would be to put all yade classes inside yade:: namespace, avoiding the clash. It works if done for Sphere only (hack). I will commit that soon.

Revision history for this message
Anton Gladky (gladky-anton) wrote : Re: [Bug 528509] Re: genCylLSM.py calls a crash

Well, Vaclav, it does not really worry me. I just call an external script,
which generate a geometry file. Then I load geo-file with
ymport.gengeoFile() function.
Ugly, but....
______________________________
Anton Gladkyy

2010/4/14 Václav Šmilauer <email address hidden>

> Ok, sorry, I just checked and GenGeo is compiled with plain g++
> separately. And yes, I also have that crash... Trying to get more
> debugging info, and will perhaps ask esys folks.
>
> --
> genCylLSM.py calls a crash
> https://bugs.launchpad.net/bugs/528509
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in Yet Another Dynamic Engine: New
>
> Bug description:
> It seems, that the function packer.generatePacking () calls a crash.
>
> .....
> InsertGenerator3D::seedParticles
> bbx: -25 -25 -25 - 25 25 225
> SIGSEGV/SIGABRT handler called; gdb batch file is `/tmp/yade-7ZdmxQ/tmp-0'
> GNU gdb (GDB) 7.0-ubuntu
> Copyright (C) 2009 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <
> http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law. Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "x86_64-linux-gnu".
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>.
> [Thread debugging using libthread_db enabled]
> [New Thread 0x7fe71a8e4910 (LWP 30782)]
> [New Thread 0x7fe71c1c4910 (LWP 30781)]
> [New Thread 0x7fe71c9c5910 (LWP 30780)]
> 0x00007fe73308db4d in __libc_waitpid (pid=30783, stat_loc=<value optimized
> out>,
> options=0) at ../sysdeps/unix/sysv/linux/waitpid.c:41
> 41 ../sysdeps/unix/sysv/linux/waitpid.c: No such file or directory.
> in ../sysdeps/unix/sysv/linux/waitpid.c
> No symbol "info" in current context.
>
> Thread 4 (Thread 0x7fe71c9c5910 (LWP 30780)):
> #0 sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:85
> #1 0x00000000004cd598 in PyThread_acquire_lock (lock=0x23f3710,
> waitflag=128) at ../Python/thread_pthread.h:349
> #2 0x000000000049c85a in PyEval_AcquireThread (tstate=0x2b41c50) at
> ../Python/ceval.c:253
> #3 0x00000000004d0bdc in t_bootstrap (boot_raw=0x2a86e20) at
> ../Modules/threadmodule.c:424
> #4 0x00007fe733c01a04 in start_thread (arg=<value optimized out>) at
> pthread_create.c:300
> #5 0x00007fe7330c980d in clone () at
> ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
> #6 0x0000000000000000 in ?? ()
>
> To unsubscribe from this bug, go to:
> https://bugs.launchpad.net/yade/+bug/528509/+subscribe
>

Revision history for this message
Václav Šmilauer (eudoxos) wrote : Re: genCylLSM.py calls a crash

BTW your module is called GenGeo? I have gengeo here, from trunk of gengeo. Perhaps it change in the meantime?

Revision history for this message
Anton Gladky (gladky-anton) wrote : Re: [Bug 528509] Re: genCylLSM.py calls a crash

from GenGeo import *
works for me. Never payed an attention on it.
______________________________

Anton Gladkyy

2010/4/14 Václav Šmilauer <email address hidden>

> BTW your module is called GenGeo? I have gengeo here, from trunk of
> gengeo. Perhaps it change in the meantime?
>
> --
> genCylLSM.py calls a crash
> https://bugs.launchpad.net/bugs/528509
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in Yet Another Dynamic Engine: New
>
> Bug description:
> It seems, that the function packer.generatePacking () calls a crash.
>
> .....
> InsertGenerator3D::seedParticles
> bbx: -25 -25 -25 - 25 25 225
> SIGSEGV/SIGABRT handler called; gdb batch file is `/tmp/yade-7ZdmxQ/tmp-0'
> GNU gdb (GDB) 7.0-ubuntu
> Copyright (C) 2009 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <
> http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law. Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "x86_64-linux-gnu".
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>.
> [Thread debugging using libthread_db enabled]
> [New Thread 0x7fe71a8e4910 (LWP 30782)]
> [New Thread 0x7fe71c1c4910 (LWP 30781)]
> [New Thread 0x7fe71c9c5910 (LWP 30780)]
> 0x00007fe73308db4d in __libc_waitpid (pid=30783, stat_loc=<value optimized
> out>,
> options=0) at ../sysdeps/unix/sysv/linux/waitpid.c:41
> 41 ../sysdeps/unix/sysv/linux/waitpid.c: No such file or directory.
> in ../sysdeps/unix/sysv/linux/waitpid.c
> No symbol "info" in current context.
>
> Thread 4 (Thread 0x7fe71c9c5910 (LWP 30780)):
> #0 sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:85
> #1 0x00000000004cd598 in PyThread_acquire_lock (lock=0x23f3710,
> waitflag=128) at ../Python/thread_pthread.h:349
> #2 0x000000000049c85a in PyEval_AcquireThread (tstate=0x2b41c50) at
> ../Python/ceval.c:253
> #3 0x00000000004d0bdc in t_bootstrap (boot_raw=0x2a86e20) at
> ../Modules/threadmodule.c:424
> #4 0x00007fe733c01a04 in start_thread (arg=<value optimized out>) at
> pthread_create.c:300
> #5 0x00007fe7330c980d in clone () at
> ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
> #6 0x0000000000000000 in ?? ()
>
> To unsubscribe from this bug, go to:
> https://bugs.launchpad.net/yade/+bug/528509/+subscribe
>

Revision history for this message
Václav Šmilauer (eudoxos) wrote : Re: genCylLSM.py calls a crash

Nasty thing. There was Sphere class in SpherePadder as well. You can test, it should work now, in r2143.

I am hesitating marking this as fixed, as it is really just a workaround.

Changed in yade:
milestone: none → 0.30-0
status: New → Fix Released
summary: - genCylLSM.py calls a crash
+ GenGeo module crashes when imported in yade (not in pure python)
Revision history for this message
Anton Gladky (gladky-anton) wrote :

Thank you! It is working now.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.