# PETSc crashes for more than one process

**URL:** <https://community.freefem.org/t/petsc-crashes-for-more-than-one-process/3679>\
**Category:** General Discussion\
**Created:** [January 8, 2025, 11:11pm UTC](https://community.freefem.org/t/petsc-crashes-for-more-than-one-process/3679 "2025-01-08T23:11:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexei](https://avatars.discourse-cdn.com/v4/letter/a/c77e96/32.png) [@Alexei](https://community.freefem.org/u/Alexei)\
**Post date:** [January 8, 2025, 11:11pm UTC](https://community.freefem.org/t/petsc-crashes-for-more-than-one-process/3679/1 "2025-01-08T23:11:59Z")

</div>

Hello,

I have run into unexpected trouble with the following SLEPc code :

[fiber-SLEPc.edp](https://community.freefem.org/uploads/short-url/vxUzsRJAT0ToNoVyLxNbjNY8xNo.edp) (4.5 KB)

which is a modification of the eigenvalue problems :

schrodinger-harmonic-oscillator-1d-SLEPc.edp  
schrodinger-harmonic-oscillator-2d-SLEPc.edp

the code runs correctly for :

ff-mpirun -np 1 fiber-SLEPc.edp -lx 100 -ly 50

but crashes for  
ff-mpirun -np 2 fiber-SLEPc.edp -lx 100 -ly 50

— global mesh of 4364 elements (prior to refinement) partitioned with metis --metisA: 2-way Edge-Cut: 3, Balance: 1.00 Nodal=0/Dual 1  
(in 7.626669e-03)  
— partition of unity built (in 2.123956e-02)  
double free or corruption (out)  
[meso-pl7524:1176801] \*\*\* Process received signal \*\*\*  
[meso-pl7524:1176801] Signal: Aborted (6)  
[meso-pl7524:1176801] Signal code: (-6)  
[meso-pl7524:1176801] [0] /lib/x86\_64-linux-gnu/libpthread.so.0(+0x14420)[0x7f3c5b743420]

except for a difference in geometry, the code is identical to the Schrodinger code which runs without crashing so I am not sure what goes wrong.

Thanks a lot for your suggestions,  
Alexei

---

<div class="post-metadata">

**Author:** ![Alexei](https://avatars.discourse-cdn.com/v4/letter/a/c77e96/32.png) [@Alexei](https://community.freefem.org/u/Alexei)\
**Post date:** [January 9, 2025, 1:40pm UTC](https://community.freefem.org/t/petsc-crashes-for-more-than-one-process/3679/2 "2025-01-09T13:40:53Z")

</div>

the mistake was to have  
{  
mesh Th=buildmesh( D1(Lx) + D2(Ly) );  
}  
instead of  
{  
Th=buildmesh( D1(Lx) + D2(Ly) );  
}  
overshadowing the global mesh variable

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [January 10, 2025, 2:14pm UTC](https://community.freefem.org/t/petsc-crashes-for-more-than-one-process/3679/3 "2025-01-10T14:14:35Z")

</div>

That’s subtle, good catch!
