[petsc-dev] Reached the main program with an out-of-range error code 1. This should never happen

Matthew Knepley knepley at gmail.com
Fri Nov 4 08:36:23 CDT 2022


On Fri, Nov 4, 2022 at 9:03 AM Stefano Zampini <stefano.zampini at gmail.com>
wrote:

> Look at the stacktrace. It is all petsc. Who is supposed to be this
> someone?
>

I looked at the code and did not see a 1. I think there is memory
corruption that is writing over the error code on the stack.

   Matt


> On Fri, Nov 4, 2022, 15:07 Jacob Faibussowitsch <jacob.fai at gmail.com>
> wrote:
>
>> I’ve seen these too. It’s from here, right at the end of the error
>> handler. `n` is the error code so someone is returning an unknown error
>> code somewhere.
>>
>> PetscStrncmp(fun, "main", 4, &ismain);
>> if (ismain) {
>>   if ((n <= PETSC_ERR_MIN_VALUE) || (n >= PETSC_ERR_MAX_VALUE))
>> (*PetscErrorPrintf)("Reached the main program with an out-of-range error
>> code %d. This should never happen\n", n);
>>     PetscOptionsViewError();
>>     PetscErrorPrintfHilight();
>>     (*PetscErrorPrintf)("----------------End of Error Message -------send
>> entire error message to petsc-maint at mcs.anl.gov----------\n");
>>     PetscErrorPrintfNormal();
>>   }
>> }
>>
>> Best regards,
>>
>> Jacob Faibussowitsch
>> (Jacob Fai - booss - oh - vitch)
>>
>> > On Nov 4, 2022, at 05:06, Stefano Zampini <stefano.zampini at gmail.com>
>> wrote:
>> >
>> > What does the message imply? That PETSc error handler is misbehaving?
>> or that the user code is wrong? I don't understand. This is the latest
>> release with a faulty code that I use as an example for using valgrind and
>> gdb.
>> >
>> > [0]PETSC ERROR: Memory corruption:
>> https://petsc.org/release/faq/#valgrind
>> > [0]PETSC ERROR: Corrupted memory
>> > [0]PETSC ERROR: See https://petsc.org/release/faq/ for trouble
>> shooting.
>> > [0]PETSC ERROR: Petsc Release Version 3.18.1, unknown
>> > [0]PETSC ERROR: ./vecerror on a arch-ecrcml-double-debug named
>> localhost.localdomain by szampini Fri Nov  4 12:01:33 2022
>> > [0]PETSC ERROR: Configure options ...
>> > [0]PETSC ERROR: #1 PetscTrFreeDefault() at
>> /home/szampini/Devel/miniforge/Devel/petsc/src/sys/memory/mtr.c:305
>> > [0]PETSC ERROR: #2 VecDestroy_Seq() at
>> /home/szampini/Devel/miniforge/Devel/petsc/src/vec/vec/impls/seq/bvec2.c:753
>> > [0]PETSC ERROR: #3 VecDestroy() at
>> /home/szampini/Devel/miniforge/Devel/petsc/src/vec/vec/interface/vector.c:521
>> > [0]PETSC ERROR: #4 main() at
>> /home/szampini/Devel/petscexamples/debugging/vecerror.c:22
>> > [0]PETSC ERROR: Reached the main program with an out-of-range error
>> code 1. This should never happen
>> >
>> > --
>> > Stefano
>>
>>

-- 
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-dev/attachments/20221104/055ab1b0/attachment.html>


More information about the petsc-dev mailing list