Metafor

ULiege - Aerospace & Mechanical Engineering

User Tools

Site Tools


commit:2018:04_27

Commit - LPx - 27 Avril 2018

Debug Memoire + Divers

Debug Memoire

  • Ayant observé dans les log des machines Linux (merci LogWatch qui nous fait résumé régulier de ce qui se passe sur la machine) une série de bug à l'execution de python :
--------------------- Kernel Begin ------------------------ 

 
 WARNING:  Segmentation Faults in these executables
    python :  243 Time(s)
 
 ---------------------- Kernel End ------------------------- 
  • Ayant dans un premier temps cru (après une première analyse trop sommaire) que ca correspondait à des lancement de batteries de développement de Gaetan
  • Après une analyse plus fouillée, il apparait que ces 245 erreurs interviennent à chaque batterie depuis un certain temps…
  • d'après le fichier /var/log/kern.log, les erreurs provenaient manifestement d'un bug mémoire (libtbbmalloc)
Apr 23 03:18:46 gaston kernel: [16820059.189283] python[16602]: segfault at 10 ip 00007f0e8cac9ca5 sp 00007ffed8e217a0 error 6 in libtbbmalloc.so.2[7f0e8cab8000+30000]
  • Pour trouver quels tests sont en cause, j'ai sorti le PID de chaque tests dans le fichier *.res afin de le confronter au PID du python dans les logs
  • Après avoir relancé une batterie, j'ai confronté les PID des tests avec ceux des logs pour me rendre compte que tous les tests problématiques avaient un point commun : le chargement de “mtDataTransfer”. Soit les tests ALE, remeshing et XFem (version Ewen)
  • Ayant un test présentant le bug, j'ai installé Valgrind sur gaston, recompilé metafor en Debug
cmake -C ../oo_meta/CMake/spring.cmake -D CMAKE_BUILD_TYPE=Debug ../oo_meta 
  • L'analyse mémoire sur un test ALE (en augmentant le nombre de fonctions d'appel sortie à 20 pour voir l'entièreté du callStack) est faite via la commande (on redirige toutes les sortie vers un fichier “pipo”):
valgrind --num-callers=20 ./Metafor -nogui -run apps.ale.coining2D > pipo 2>&1
  • la sortie de Valgrind relative au bug ressemble à ca :
==5222== Invalid free() / delete / delete[] / realloc()
==5222==    at 0x4C2D2DB: operator delete(void*) (vg_replace_malloc.c:576)
==5222==    by 0x11C0755F: __gnu_cxx::new_allocator<std::_Rb_tree_node<Factory<Element> const*> >::deallocate(std::_Rb_tree_node<Factory<Element> const*>*, unsigned long) (new_allocator.h:110)
==5222==    by 0x11C0752F: std::allocator_traits<std::allocator<std::_Rb_tree_node<Factory<Element> const*> > >::deallocate(std::allocator<std::_Rb_tree_node<Factory<Element> const*> >&, std::_Rb_tree_node<Factory<Element> const*>*, unsigned long) (alloc_traits.h:462)
==5222==    by 0x11C0741B: std::_Rb_tree<Factory<Element> const*, Factory<Element> const*, std::_Identity<Factory<Element> const*>, IDPtrLess<Factory<Element> >, std::allocator<Factory<Element> const*> >::_M_put_node(std::_Rb_tree_node<Factory<Element> const*>*) (stl_tree.h:509)
==5222==    by 0x11C0737B: std::_Rb_tree<Factory<Element> const*, Factory<Element> const*, std::_Identity<Factory<Element> const*>, IDPtrLess<Factory<Element> >, std::allocator<Factory<Element> const*> >::_M_drop_node(std::_Rb_tree_node<Factory<Element> const*>*) (stl_tree.h:576)
==5222==    by 0x11C072A7: std::_Rb_tree<Factory<Element> const*, Factory<Element> const*, std::_Identity<Factory<Element> const*>, IDPtrLess<Factory<Element> >, std::allocator<Factory<Element> const*> >::_M_erase(std::_Rb_tree_node<Factory<Element> const*>*) (stl_tree.h:1640)
==5222==    by 0x11C0728A: std::_Rb_tree<Factory<Element> const*, Factory<Element> const*, std::_Identity<Factory<Element> const*>, IDPtrLess<Factory<Element> >, std::allocator<Factory<Element> const*> >::_M_erase(std::_Rb_tree_node<Factory<Element> const*>*) (stl_tree.h:1638)
==5222==    by 0x11C0728A: std::_Rb_tree<Factory<Element> const*, Factory<Element> const*, std::_Identity<Factory<Element> const*>, IDPtrLess<Factory<Element> >, std::allocator<Factory<Element> const*> >::_M_erase(std::_Rb_tree_node<Factory<Element> const*>*) (stl_tree.h:1638)
==5222==    by 0x11C07217: std::_Rb_tree<Factory<Element> const*, Factory<Element> const*, std::_Identity<Factory<Element> const*>, IDPtrLess<Factory<Element> >, std::allocator<Factory<Element> const*> >::~_Rb_tree() (stl_tree.h:873)
==5222==    by 0x11C071C4: std::set<Factory<Element> const*, IDPtrLess<Factory<Element> >, std::allocator<Factory<Element> const*> >::~set() (stl_set.h:90)
==5222==    by 0x11C07192: PropertyID<Factory<Element> >::~PropertyID() (PropertyID.h:20)
==5222==    by 0x11C070E4: BooleanPropertyID<Factory<Element> >::~BooleanPropertyID() (PropertyID.h:37)
==5222==    by 0x16F48C7E: __cxa_finalize (cxa_finalize.c:56)
==5222==    by 0x11BDA922: ??? (in /home/papeleux/Dev/Offi/oo_metaD/bin/libmtElements.so)
==5222==    by 0x400FE79: _dl_fini (dl-fini.c:235)
==5222==    by 0x16F4890F: __run_exit_handlers (exit.c:83)
==5222==    by 0x16F48969: exit (exit.c:105)
==5222==    by 0x15E64E5E: Py_Exit (in /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0)
==5222==    by 0x15E64F99: ??? (in /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0)
==5222==    by 0x15E65234: PyErr_PrintEx (in /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0)
==5222==  Address 0x3ac953a0 is 0 bytes inside a block of size 40 free'd
==5222==    at 0x4C2D2DB: operator delete(void*) (vg_replace_malloc.c:576)
==5222==    by 0x11C0755F: __gnu_cxx::new_allocator<std::_Rb_tree_node<Factory<Element> const*> >::deallocate(std::_Rb_tree_node<Factory<Element> const*>*, unsigned long) (new_allocator.h:110)
==5222==    by 0x11C0752F: std::allocator_traits<std::allocator<std::_Rb_tree_node<Factory<Element> const*> > >::deallocate(std::allocator<std::_Rb_tree_node<Factory<Element> const*> >&, std::_Rb_tree_node<Factory<Element> const*>*, unsigned long) (alloc_traits.h:462)
==5222==    by 0x11C0741B: std::_Rb_tree<Factory<Element> const*, Factory<Element> const*, std::_Identity<Factory<Element> const*>, IDPtrLess<Factory<Element> >, std::allocator<Factory<Element> const*> >::_M_put_node(std::_Rb_tree_node<Factory<Element> const*>*) (stl_tree.h:509)
==5222==    by 0x11C0737B: std::_Rb_tree<Factory<Element> const*, Factory<Element> const*, std::_Identity<Factory<Element> const*>, IDPtrLess<Factory<Element> >, std::allocator<Factory<Element> const*> >::_M_drop_node(std::_Rb_tree_node<Factory<Element> const*>*) (stl_tree.h:576)
==5222==    by 0x11C072A7: std::_Rb_tree<Factory<Element> const*, Factory<Element> const*, std::_Identity<Factory<Element> const*>, IDPtrLess<Factory<Element> >, std::allocator<Factory<Element> const*> >::_M_erase(std::_Rb_tree_node<Factory<Element> const*>*) (stl_tree.h:1640)
==5222==    by 0x11C0728A: std::_Rb_tree<Factory<Element> const*, Factory<Element> const*, std::_Identity<Factory<Element> const*>, IDPtrLess<Factory<Element> >, std::allocator<Factory<Element> const*> >::_M_erase(std::_Rb_tree_node<Factory<Element> const*>*) (stl_tree.h:1638)
==5222==    by 0x11C0728A: std::_Rb_tree<Factory<Element> const*, Factory<Element> const*, std::_Identity<Factory<Element> const*>, IDPtrLess<Factory<Element> >, std::allocator<Factory<Element> const*> >::_M_erase(std::_Rb_tree_node<Factory<Element> const*>*) (stl_tree.h:1638)
==5222==    by 0x11C07217: std::_Rb_tree<Factory<Element> const*, Factory<Element> const*, std::_Identity<Factory<Element> const*>, IDPtrLess<Factory<Element> >, std::allocator<Factory<Element> const*> >::~_Rb_tree() (stl_tree.h:873)
==5222==    by 0x11C071C4: std::set<Factory<Element> const*, IDPtrLess<Factory<Element> >, std::allocator<Factory<Element> const*> >::~set() (stl_set.h:90)
==5222==    by 0x11C07192: PropertyID<Factory<Element> >::~PropertyID() (PropertyID.h:20)
==5222==    by 0x11C070E4: BooleanPropertyID<Factory<Element> >::~BooleanPropertyID() (PropertyID.h:37)
==5222==    by 0x16F4890F: __run_exit_handlers (exit.c:83)
==5222==    by 0x16F48969: exit (exit.c:105)
==5222==    by 0x15E64E5E: Py_Exit (in /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0)
==5222==    by 0x15E64F99: ??? (in /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0)
==5222==    by 0x15E65234: PyErr_PrintEx (in /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0)
==5222==    by 0x15E654CB: PyRun_SimpleStringFlags (in /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0)
==5222==    by 0x565464C: PythonInterpreter::run() (PythonInterpreter.cpp:211)
==5222==    by 0x401966: main (main.cpp:80)
==5222==  Block was alloc'd at
==5222==    at 0x4C2C21F: operator new(unsigned long) (vg_replace_malloc.c:334)
==5222==    by 0x13063AA0: __gnu_cxx::new_allocator<std::_Rb_tree_node<Factory<Element> const*> >::allocate(unsigned long, void const*) (new_allocator.h:104)
==5222==    by 0x13063A4B: std::allocator_traits<std::allocator<std::_Rb_tree_node<Factory<Element> const*> > >::allocate(std::allocator<std::_Rb_tree_node<Factory<Element> const*> >&, unsigned long) (alloc_traits.h:436)
==5222==    by 0x13063953: std::_Rb_tree<Factory<Element> const*, Factory<Element> const*, std::_Identity<Factory<Element> const*>, IDPtrLess<Factory<Element> >, std::allocator<Factory<Element> const*> >::_M_get_node() (stl_tree.h:505)
==5222==    by 0x130638FF: std::_Rb_tree_node<Factory<Element> const*>* std::_Rb_tree<Factory<Element> const*, Factory<Element> const*, std::_Identity<Factory<Element> const*>, IDPtrLess<Factory<Element> >, std::allocator<Factory<Element> const*> >::_M_create_node<Factory<Element> const*>(Factory<Element> const*&&) (stl_tree.h:559)
==5222==    by 0x130638D2: std::_Rb_tree_node<Factory<Element> const*>* std::_Rb_tree<Factory<Element> const*, Factory<Element> const*, std::_Identity<Factory<Element> const*>, IDPtrLess<Factory<Element> >, std::allocator<Factory<Element> const*> >::_Alloc_node::operator()<Factory<Element> const*>(Factory<Element> const*&&) const (stl_tree.h:473)
==5222==    by 0x130636AB: std::_Rb_tree_iterator<Factory<Element> const*> std::_Rb_tree<Factory<Element> const*, Factory<Element> const*, std::_Identity<Factory<Element> const*>, IDPtrLess<Factory<Element> >, std::allocator<Factory<Element> const*> >::_M_insert_<Factory<Element> const*, std::_Rb_tree<Factory<Element> const*, Factory<Element> const*, std::_Identity<Factory<Element> const*>, IDPtrLess<Factory<Element> >, std::allocator<Factory<Element> const*> >::_Alloc_node>(std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, Factory<Element> const*&&, std::_Rb_tree<Factory<Element> const*, Factory<Element> const*, std::_Identity<Factory<Element> const*>, IDPtrLess<Factory<Element> >, std::allocator<Factory<Element> const*> >::_Alloc_node&) (stl_tree.h:1535)
==5222==    by 0x13063382: std::pair<std::_Rb_tree_iterator<Factory<Element> const*>, bool> std::_Rb_tree<Factory<Element> const*, Factory<Element> const*, std::_Identity<Factory<Element> const*>, IDPtrLess<Factory<Element> >, std::allocator<Factory<Element> const*> >::_M_insert_unique<Factory<Element> const*>(Factory<Element> const*&&) (stl_tree.h:1894)
==5222==    by 0x1305F32B: std::set<Factory<Element> const*, IDPtrLess<Factory<Element> >, std::allocator<Factory<Element> const*> >::insert(Factory<Element> const*&&) (stl_set.h:492)
==5222==    by 0x1305F2EE: PropertyID<Factory<Element> >::setValidFor(Factory<Element> const&) (PropertyID.hpp:28)
==5222==    by 0x11C08B80: Factory<Element>::allowProperty(PropertyID<Factory<Element> >&) (Factory.inl:31)
==5222==    by 0x429C02DB: TransferCell::initID(Factory<Element>*) (TransferCell.cpp:14)
==5222==    by 0x42984034: FVTransferCell::initID(Factory<Element>*) (FVTransferCell.cpp:28)
==5222==    by 0x42606964: LinearRecConvCell::initID(Factory<Element>*) (LinearRecConvCell.cpp:31)
==5222==    by 0x42607574: LinearRecConvCell::init(FactoryArgs const&) (LinearRecConvCell.h:16)
==5222==    by 0x1305F63E: Factory<Element>::callInit(FactoryArgs const&) const (Factory.inl:59)
==5222==    by 0x1305DE52: ElementIDList::init() (ElementIDList.cpp:47)
==5222==    by 0x4229FCEA: init_mtALE (mtALEPYTHON_wrap.cxx:23720)
==5222==    by 0x15EBAE3B: _PyImport_LoadDynamicModule (in /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0)
==5222==    by 0x15EBBC60: ??? (in /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0)
==5222==
  • On peut en déduire :
    • qu'il s'agit d'un bug de désallocation d'un BooleanPropertyID
    • Property qui a été alloué au seins des TransferCell
  • après analyse, il s'agissait en fait d'une double définition de la propriété des élément (ElementBooleanPropertyID) “VERBOSE” à la fois dans mtElements et dans mtDataTransfert
  • ⇒ les classes dérivant de TransfertCell ont été modifiée pour utiliser le “VERBOSE” de mtElements (ainsi que les CMakeLists pour que mtDataTransfer linke avec mtElements)
  • J'ai un peu modifié les fonctions InitId des TransferCell pour refléter la structure informatique du code (pas d'appel à des fonctions de classes dont on ne dérive pas)

Divers

  • sortie de données relatives à l'execution d'un test au chargement de Metafor :
    • Le nom de la machine et la date d'execution d'un test était déjà sorti à l'écran, mais intervenait tard dans la procédure ⇒ j'ai remonté cette sortie à la fin du chargement du .pythonrc.py
    • j'ai ajouté le 'adress IP de la machine, le nom de l'utilisateur, le répertoire à partir duquel on a lancé Metafor et le PID.
    • Ca donne ca :
============================================================
	run on     :  Corto  - IP :  192.168.56.1
	at         :  Thu Apr 26 19:13:56 2018
	by         :  papeleux
	From       :  e:\Dev64\Offi\MetaBin\bin\Release
	Process Id :  6648
=============================================================
  • si d'autres données sont nécessaires/utiles à imprimer, la fonction d'impression est “printRunInfo()” de “toolbox.utilities”. N'hésitez pas !!!!
  • Correction comp.py pour compiler en Debug (merci à Romain pour le commit)

Gravity :

  • addInertialForces(mtMath::Vector &F) : remplacment de “fillWith” par “addWith” dans le calcul des forces inertielles la mise à 0 ayant déjà été faite en amont. Ca permettra le cas échéant de tranférer les forces de gravité vers les forces internes (ca peut se discuter philosophiquement et ca pourrait être nécessaire au couplage “CuPyDo”).
  • Ajout de tests où on additionne des Fext définies par loading sur un même DOF (voir commit 3138)

Fichiers ajoutés/supprimés :

Added : 
Deleted : 
Moved : 

Tests ajoutés/supprimés

Adding: oo_meta\apps\monosMeca\gravityFExt1.py
Adding: oo_meta\apps\monosMeca\gravityFExt2.py
Deleted : 
Moved : 

Luc Papeleux 2018/04/27

commit/2018/04_27.txt · Last modified: 2018/04/27 11:22 by papeleux

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki