Subject: bug#21738: 25.0.50; eww freezes/crashes at times

From: Eli Zaretskii <[email-masked]>
Date: Fri, 23 Oct 2015 17:29:08 +0300

> From: Kaushal Modi <[email-masked]>
> Date: Fri, 23 Oct 2015 10:01:30 -0400
> Cc: [email-masked]
> 
> > This indicates that Emacs hangs inside Imagemagick code, trying to
> > display one of the images on that page.  Can you build Emacs without
> > Imagemagick support, and see if that fixes the problem?
> 
> eww works fine without Imagemagick.
> But then I lose all the emacs features that need Imagemagick (like
> formula image rendering in org-> latex exports).

Is your Imagemagick up-to-date?  If not, perhaps this is some bug in
Imagemagick that was already fixed, so upgrading might fix it.  Or
maybe downgrade to some previous version.

Another idea woukd be to ask on emacs-devel which versions of
Imagemagick do people use who can successfully display that page.

> Does the backtrace give a hint to what could have gone wrong with the
> Imagemagick build?

Not to me, I'm not familiar with Imagemagick enough for that.

> What Imagemagick version are you using?

I don't.  That's why I thought about building without it.

> Does this error hint anything?
> 
> > emacs: Memory allocation failed `No such file or directory' @ fatal/tiff.c/UnregisterTIFFImage/2077

It seems to be related, because the backtrace also points to that
function:

  #0 0x0000003a9840eb9e in ?? () from /usr/lib64/libgomp.so.1
  #1 0x00007ffff60875f8 in MagickCoreTerminus ()
  from /home/kmodi/usr_local/6/lib/libMagickCore-6.Q16.so.2
  #2 0x00007ffff604a584 in DefaultFatalErrorHandler ()
  from /home/kmodi/usr_local/6/lib/libMagickCore-6.Q16.so.2
  #3 0x00007ffff604adb2 in CatchException () from
  /home/kmodi/usr_local/6/lib/libMagickCore-6.Q16.so.2
  #4 0x00007ffff621f6c8 in UnregisterTIFFImage ()  <<<<<<<<<<<<<<<<<<<<<<
  from /home/kmodi/usr_local/6/lib/libMagickCore-6.Q16.so.2
  #5 0x00007ffff60f6580 in UnregisterStaticModules ()
  from /home/kmodi/usr_local/6/lib/libMagickCore-6.Q16.so.2
  #6 0x00007ffff6087638 in MagickCoreTerminus ()
  from /home/kmodi/usr_local/6/lib/libMagickCore-6.Q16.so.2
  #7 0x0000000000692ac9 in imagemagick_load_image (f=0x12afcb0, img=0x1dc7f20,
  contents=0x1e72668 "\211PNG\r\n\032\n", size=134459, filename=0x0) at

According to this, the function UnregisterStaticModules generated a
fatal exception.  I don't quite understand how "memory allocation
failed" can be explained by "No such file or directory", but then I'm
not familiar with Imagemagick in general and with that function in
particular.

> > Also, you originally said that "emacs -Q" doesn't exhibit this
> > problem, but now you've succeeded in reproducing it in "emacs -Q" as
> > well.  What did you need to do in order to succeed reproducing this in
> > "emacs -Q"?
> 
> I usually use eww to open few work internal websites which are
> autogenerated with an SVG plot and a huge HTML table. I have seen
> those pages to open fine on emacs -Q but fail to load *sometimes* on
> my emacs with my config loaded.
> 
> It just happens that yesterday I tried opening braveclojure.com in eww
> and it froze my emacs and so I sent that email to emacs-devel. I
> simply assumed that it will open fine on emacs -Q. But now we know
> that it froze my emacs -Q too. I have consistently been able to freeze
> emacs -Q (built with Imagemagick) when I open that braveclojure.com
> site on eww.

The images on that page are PNG image files.  Can you display PNG
image files with an Emacs compiled with Imagemagick support, or does
Emacs hang (or crash) with every PNG file?