[erlang-questions] Segmentation fault when writing erl_crash.dump
Chris Newcombe
chris.newcombe@REDACTED
Tue Feb 20 18:41:29 CET 2007
Thanks! This fixes the frequent seg-v's that occured if my
application's regression tests exit with an unexpected
exception/error.
Please could this fix be included in the next Erlang/OTP release?
One possible concern; perhaps the original code used a stack-buffer
instead of erts_alloc incase the reason for the exit was an
out-of-memory condition? It would be unfortunate if this fix
prevented crash dumps due to memory-allocation issues. I haven't
looked, but I wonder if it is possible to fix this while still using
static buffers? (e.g. Checking whether the term fits in the buffer,
and splitting it/truncating it if it does not fit?)
thanks,
Chris Newcombe
On 2/19/07, Christopher Faulet <christopher.faulet@REDACTED> wrote:
> Jean-Sébastien Pédron a écrit :
> > While working on a testsuite, erl crashed and beam segfaulted during
> > erl_crash.dump write.
> >
> > After some searches, the problem comes from the function
> > `dump_externally' in erts/emulator/beam/erl_process_dump.c. It gives to
> > the function `erts_to_external_format' a 1024-bytes buffer but one of
> > the terms doesn't fit into this.
> >
> [...]
> >
> > By increasing the buffer length, it "fixes" the crash but I guess this
> > isn't the best solution.
>
> Hi,
>
> I agree with you, a dynamic allocation for this buffer might be a
> better solution.
>
> By exploring the code, especially the file
> "erts/emulator/beam/external.c" where the bug seems to appear, I found
> the function "encode_size_struct" that could solve the problem.
>
> So I did these simple patches to fix this for R11B-2 and R11B-3. They
> are working on FreeBSD and Linux as well.
>
> Regards,
> --
> Christopher Faulet
>
More information about the erlang-questions
mailing list