Subject: Re: bug#40139: 25.2; SIGBUS

From: Eli Zaretskii <[email-masked]>
Date: Fri, 20 Mar 2020 09:30:24 +0200

> From: Vadim Zaliva <[email-masked]>
> Date: Thu, 19 Mar 2020 15:36:01 -0700
> 
> I am using 'latex-preview-pane-mode'. It renders PDF preview of the
> document. It works first time. When I do any change to the document and
> try to save it, it crashes. On console I see the following:
> [...]
> Thread 1 "emacs" received signal SIGBUS, Bus error.
> __memmove_avx_unaligned_erms ()
>     at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:306
> 306 ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S: No such file or directory.
> (gdb) bt full
> #0  0x00007ffff0defb64 in __memmove_avx_unaligned_erms ()
>     at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:306
> #1  0x00007ffff36028ac in ReadBlob () at /usr/lib/x86_64-linux-gnu/libMagickCore-6.Q16.so.3
> #2  0x00007fffe2b6843e in  ()
>     at /usr/lib/x86_64-linux-gnu/ImageMagick-6.9.7/modules-Q16/coders/png.so
> #3  0x00007ffff76dbb6f in  () at /usr/lib/x86_64-linux-gnu/libpng16.so.16
> #4  0x00007ffff76dbc5f in  () at /usr/lib/x86_64-linux-gnu/libpng16.so.16
> #5  0x00007ffff76e0322 in  () at /usr/lib/x86_64-linux-gnu/libpng16.so.16
> #6  0x00007ffff76d2ae3 in png_read_row () at /usr/lib/x86_64-linux-gnu/libpng16.so.16
> #7  0x00007fffe2b7a887 in  ()
>     at /usr/lib/x86_64-linux-gnu/ImageMagick-6.9.7/modules-Q16/coders/png.so
> #8  0x00007fffe2b7b4d6 in  ()
>     at /usr/lib/x86_64-linux-gnu/ImageMagick-6.9.7/modules-Q16/coders/png.so
> #9  0x00007ffff363a9df in ReadImage () at /usr/lib/x86_64-linux-gnu/libMagickCore-6.Q16.so.3
> #10 0x00007ffff3b0f46a in MagickReadImage ()
>     at /usr/lib/x86_64-linux-gnu/libMagickWand-6.Q16.so.3
> [...]
> It looks ImageMagick problem.

Indeed.

> Howevr if it crashes or otherwise
> misbehaves it should not bring down my whole emacs process.

A fatal signal in any C library used by Emacs will necessarily bring
the whole Emacs process down.  Emacs tries to catch these signals and
perform auto-saving, but after doing so it has no choice but shut
down, because there's no way of continuing from such fatal signals on
modern operating systems.

ImageMagick has many stability problems, which is why Emacs is moving
away of using it, by implementing some of its capabilities natively,
and by replacing its other capabilities with other external libraries.
My suggestion is to try the latest Emacs (version 26.3 is the latest
official release; version 27.1 is in pretest and can be downloaded
from alpha.gnu.org), and upgrade your ImageMagick to a more stable
version if that is possible.

Other than that, I don't see how this problem can be solved in Emacs.

Thanks.