[petsc-users] KSP_Solve crashes in debug mode

Barry Smith bsmith at petsc.dev
Wed Feb 15 14:01:11 CST 2023


https://gitlab.com/petsc/petsc/-/merge_requests/6075 should fix the possible recursive error condition Matt pointed out


> On Feb 9, 2023, at 6:24 PM, Matthew Knepley <knepley at gmail.com> wrote:
> 
> On Thu, Feb 9, 2023 at 6:05 PM Sajid Ali Syed via petsc-users <petsc-users at mcs.anl.gov <mailto:petsc-users at mcs.anl.gov>> wrote:
>> I added “-malloc_debug” in a .petscrc file and ran it again. The backtrace from lldb is in the attached file. The crash now seems to be at:
>> 
>> Process 32660 stopped* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, address=0x16f603fb8)
>>     frame #0: 0x0000000112ecc8f8 libpetsc.3.018.dylib`PetscFPrintf(comm=0, fd=0x0000000000000000, format=0x0000000000000000) at mprint.c:601
>>    598               `PetscViewerASCIISynchronizedPrintf()`, `PetscSynchronizedFlush()`
>>    599      @*/
>>    600      PetscErrorCode PetscFPrintf(MPI_Comm comm, FILE *fd, const char format[], ...)
>> -> 601      {
>>    602       PetscMPIInt rank;
>>    603      
>>    604       PetscFunctionBegin;
>> (lldb) frame info
>> frame #0: 0x0000000112ecc8f8 libpetsc.3.018.dylib`PetscFPrintf(comm=0, fd=0x0000000000000000, format=0x0000000000000000) at mprint.c:601
>> (lldb)
>> The trace seems to indicate some sort of infinite loop causing an overflow.
>> 
> 
> Yes, I have also seen this. What happens is that we have a memory error. The error is reported inside PetscMallocValidate()
> using PetscErrorPrintf, which eventually calls PetscCallMPI, which calls PetscMallocValidate again, which fails. We need to
> remove all error checking from the prints inside Validate.
> 
>   Thanks,
> 
>      Matt
>  
>> PS: I'm using a arm64 mac, so I don't have access to valgrind. 
>> 
>> Thank You,
>> Sajid Ali (he/him) | Research Associate
>> Scientific Computing Division
>> Fermi National Accelerator Laboratory
>> s-sajid-ali.github.io <http://s-sajid-ali.github.io/>
> 
> 
> -- 
> What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
> -- Norbert Wiener
> 
> https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230215/d9988b12/attachment.html>


More information about the petsc-users mailing list