YADE Crash - SIGSEGV/SIGABRT handler called

Asked by Son Pham Thai on 2019-03-23

Hi YADE community,

I have a problem as the question's title said.

The procedure that I have done:

1. Packing generation
2. Save the result by using O.save()
3. Reload the saved yade.gz file by using O.load()
4. Working around with the material and interaction and got the crash

Mini working scripts:
--- [Step 1] ---

### INPUT for Material ###
young0= 30e9
poisson0= 0.2
density0 = 2530
compFricDegree=15

### PARAMETERs of particle packing ###
mn=Vector3(0.,0.,0.)
mx=Vector3(.4e-2,.6e-2,.4e-2)
rMean0=4e-4
rRelFuzz0=5./100
porosity0=0.4
distributeMass0=True
seed0=1

### INPUT for mechanical loading ###
maxVel0=5e-7
confiningS= -2.725e5

### defining MATERIALs ###
O.materials.append(FrictMat(young=young0,poisson=poisson0,frictionAngle=radians(compFricDegree), density=density0, label='spheres'))
O.materials.append(FrictMat(young=young0,poisson=poisson0,frictionAngle=0,density=0,label='frictionlessWalls'))

### creating the boundary walls ###
walls=aabbWalls((mn,mx),thickness=0,material='frictionlessWalls')
wallIds=O.bodies.append(walls)

### generating spheres ###
sp=pack.SpherePack()
sp.makeCloud(minCorner=mn,maxCorner=mx,rMean=rMean0,rRelFuzz=rRelFuzz0,porosity=porosity0,distributeMass=distributeMass0,seed=seed0) # POLY
O.bodies.append([utils.sphere(center,rad,material='spheres') for center,rad in sp])

### mechanical loading #### To confer a solid-like nature to the packing

triax=TriaxialStressController(
 internalCompaction=True,
 goal1=confiningS,
 goal2=confiningS,
 goal3=confiningS,
 max_vel=maxVel0,
 label="triax"
)

triax.maxMultiplier=1.+5e-6
triax.finalMaxMultiplier=1.+1e-7

newton=NewtonIntegrator(damping=.4, gravity=(0.0,-9.81,0.0))

O.engines=[
 ForceResetter(),
 InsertionSortCollider([Bo1_Sphere_Aabb(label='aabb'),Bo1_Box_Aabb()]),
 InteractionLoop(
  [Ig2_Sphere_Sphere_ScGeom6D(label='Ig2ssGeom'),Ig2_Box_Sphere_ScGeom()],
  [Ip2_FrictMat_FrictMat_FrictPhys(),Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(setCohesionNow=True,setCohesionOnNewContacts=True, label="cohesiveIp")],
  [Law2_ScGeom_FrictPhys_CundallStrack(),Law2_ScGeom6D_CohFrictPhys_CohesionMoment(
   useIncrementalForm=True, always_use_moment_law=False, label='cohesiveLaw')]
 ),
 GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=100,timestepSafetyCoefficient=0.5),
 triax,
 newton
]

### --- 1st stage, particle growing while boundary walls are fixed -- ###

NumDEMRun1=100000
while 1:

 O.run(NumDEMRun1,True)
 unb=unbalancedForce()

 if unb<0.01 and abs(triax.goal1-triax.meanStress)/abs(triax.goal1)<0.001:
  break

### --- 2nd stage, particle sizes are fixed while boundary walls move very slowly -- ###

finalFricDegree = 30 # contact friction during the deviatoric loading
triax.internalCompaction=False
setContactFriction(radians(finalFricDegree))

NumDEMRun2=50000

while 1:

 O.run(NumDEMRun2 ,True)
 unb=unbalancedForce()

 if unb<0.001 and abs(triax.goal1-triax.meanStress)/abs(triax.goal1)<0.001:
  break

*********************************************************************************
--- [Step 4] ---

compFricDegree = 1 # Scholtes
young0= 30e9
poisson0= 0.2
density0 = 2530
tensileStrength = 40e5
shearStrength = 40e6

### setup the material properties, first, Cohesion material
O.materials.append(CohFrictMat(young=young0,poisson=poisson0,density=density0,frictionAngle=radians(compFricDegree), normalCohesion=tensileStrength, shearCohesion=shearStrength, momentRotationLaw=True,label='CohFrictspheres'))

### --- change material of the spheres to create cohesive bond between particles --- ###

pairs = [(i.id1,i.id2) for i in O.interactions]
for b in O.bodies:
 if not isinstance(b.shape,Box):
  b.mat = O.materials[2]
  ### [0] is Friction spheres, [1] is frictionlessWalls, [2] is the newly added CohFrict sphere

O.interactions.clear()
for id1,id2 in pairs: utils.createInteraction(id1,id2) ### The crash occurs here

*********************************************************************************

Any help or suggestion is highly appreciate!
Son Pham

Question information

Language:
English Edit question
Status:
Expired
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
2019-03-26
Last reply:
2019-04-11

PS: the full crash log is:

SIGSEGV/SIGABRT handler called; gdb batch file is `/tmp/yade-RXasLj/tmp-0'
GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.3) 7.7.1
Copyright (C) 2014 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".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
Could not attach to process. If your uid matches the uid of the target
process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
again as the root user. For more details, see /etc/sysctl.d/10-ptrace.conf
/tmp/yade-RXasLj/tmp-0:1: Error in sourced command file:
ptrace: Operation not permitted.
(gdb)

Janek Kozicki (cosurgi) said : #2

> ptrace: Operation not permitted.

Actually that’s a very unhelpful crash log. Please have a look at
 https://yade-dev.gitlab.io/trunk/introduction.html#fdbg

Hi,

thanks for the response!

The new crash log I got is:

python: /usr/include/boost/smart_ptr/shared_ptr.hpp:646: typename boost::detail::sp_dereference<T>::type boost::shared_ptr<T>::operator*() const [with T = BodyContainer; typename boost::detail::sp_dereference<T>::type = BodyContainer&]: Assertion `px != 0' failed.

SIGSEGV/SIGABRT handler called; gdb batch file is `/tmp/yade-FSueZ2/tmp-0'

GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.3) 7.7.1

Copyright (C) 2014 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".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
Could not attach to process. If your uid matches the uid of the target
process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
again as the root user. For more details, see /etc/sysctl.d/10-ptrace.conf
/tmp/yade-FSueZ2/tmp-0:1: Error in sourced command file:
ptrace: Operation not permitted.
(gdb)

To reproduce the above crash, pls try run these 2 following scripts (in 2 different terminals)

##########################
### --- Mini working scripts 1: --- ###
##########################

# encoding: utf-8
### INPUT for Material ###
young0= 30e9
poisson0= 0.2
density0 = 2530
compFricDegree=15

### PARAMETERs of particle packing ###
mn=Vector3(0.,0.,0.)
mx=Vector3(.4e-2,.6e-2,.4e-2)
rMean0=4e-4
rRelFuzz0=5./100
porosity0=0.4
distributeMass0=True
seed0=1

### INPUT for mechanical loading ###
maxVel0=5e-7
confiningS= -2.725e5

### defining MATERIALs ###
O.materials.append(FrictMat(young=young0,poisson=poisson0,frictionAngle=radians(compFricDegree), density=density0, label='spheres'))
O.materials.append(FrictMat(young=young0,poisson=poisson0,frictionAngle=0,density=0,label='frictionlessWalls'))

### creating the boundary walls ###
walls=aabbWalls((mn,mx),thickness=0,material='frictionlessWalls')
wallIds=O.bodies.append(walls)

### generating spheres ###
sp=pack.SpherePack()
sp.makeCloud(minCorner=mn,maxCorner=mx,rMean=rMean0,rRelFuzz=rRelFuzz0,porosity=porosity0,distributeMass=distributeMass0,seed=seed0) # POLY
O.bodies.append([utils.sphere(center,rad,material='spheres') for center,rad in sp])

### mechanical loading #### To confer a solid-like nature to the packing

triax=TriaxialStressController(
 internalCompaction=True,
 goal1=confiningS,
 goal2=confiningS,
 goal3=confiningS,
 max_vel=maxVel0,
 label="triax"
)

triax.maxMultiplier=1.+5e-6
triax.finalMaxMultiplier=1.+1e-7

newton=NewtonIntegrator(damping=.4, gravity=(0.0,-9.81,0.0))

O.engines=[
 ForceResetter(),
 InsertionSortCollider([Bo1_Sphere_Aabb(label='aabb'),Bo1_Box_Aabb()]),
 InteractionLoop(
  [Ig2_Sphere_Sphere_ScGeom6D(label='Ig2ssGeom'),Ig2_Box_Sphere_ScGeom()],
  [Ip2_FrictMat_FrictMat_FrictPhys(),Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(setCohesionNow=True,setCohesionOnNewContacts=True, label="cohesiveIp")],
  [Law2_ScGeom_FrictPhys_CundallStrack(),Law2_ScGeom6D_CohFrictPhys_CohesionMoment(
   useIncrementalForm=True, always_use_moment_law=False, label='cohesiveLaw')]
 ),
 GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=100,timestepSafetyCoefficient=0.5),
 triax,
 newton
]

### --- 1st stage, particle growing while boundary walls are fixed -- ###

NumDEMRun1=100000
while 1:

 O.run(NumDEMRun1,True)
 unb=unbalancedForce()

 if unb<0.01 and abs(triax.goal1-triax.meanStress)/abs(triax.goal1)<0.001:
  break

### --- 2nd stage, particle sizes are fixed while boundary walls move very slowly -- ###

finalFricDegree = 30 # contact friction during the deviatoric loading
triax.internalCompaction=False
setContactFriction(radians(finalFricDegree))

NumDEMRun2=50000

while 1:

 O.run(NumDEMRun2 ,True)
 unb=unbalancedForce()

 if unb<0.001 and abs(triax.goal1-triax.meanStress)/abs(triax.goal1)<0.001:
  break

import os.path
initStateFilename="savedPacking" +".yade.gz"
savedState = os.path.exists(initStateFilename)
O.save(initStateFilename)

##########################
### --- Mini working scripts 2: --- ###
##########################

# encoding: utf-8

import os.path
initStateFilename='savedPacking.yade.gz'
O.load(initStateFilename)

compFricDegree = 1
young0= 30e9
poisson0= 0.2
density0 = 2530
tensileStrength = 40e5
shearStrength = 40e6

### setup the material properties, first, Cohesion material
O.materials.append(CohFrictMat(young=young0,poisson=poisson0,density=density0,frictionAngle=radians(compFricDegree), normalCohesion=tensileStrength, shearCohesion=shearStrength, momentRotationLaw=True,label='CohFrictspheres'))

### --- change material of the spheres to create cohesive bond between particles --- ###

pairs = [(i.id1,i.id2) for i in O.interactions]
for b in O.bodies:
 if not isinstance(b.shape,Box):
  b.mat = O.materials[2]
  ### [0] is Friction spheres, [1] is frictionlessWalls, [2] is the newly added CohFrict sphere

O.interactions.clear()
for id1,id2 in pairs: utils.createInteraction(id1,id2) ### The crash occurs here, detected by uncommenting line by line

Janek Kozicki (cosurgi) said : #4

Can you explain what is the general purpose (what you want to achieve) with these two lines:

O.interactions.clear()
for id1,id2 in pairs: utils.createInteraction(id1,id2)

?

Hi Janek,

In general, what I need:

1. Generating a packing with inputs: packing's dimension, porosity, particle size distribution.
    Target: a packing have the number of No-Interaction spheres as small as possible.

2. Saving this generated packing for later usage (since the packing generation costs lot of time)

3. Reloading the saved packing

4. Working around with the material and interaction.
    Since in the packing generation stage, the material of the sphere is FrictMat. What I need now is Cohesive bond between sphere. Thus, I change the material of sphere to CohFrictMat. This is my purpose of using:

O.interactions.clear()
for id1,id2 in pairs: utils.createInteraction(id1,id2)

Regards,
Son Pham

Launchpad Janitor (janitor) said : #6

This question was expired because it remained in the 'Open' state without activity for the last 15 days.