bug#40685: 28.0.50; eww browser chews up 100% cpu when displaying looping gif animations

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

bug#40685: 28.0.50; eww browser chews up 100% cpu when displaying looping gif animations

Francis Meetze

When opening a web page in the Emacs browser that contains infinite looping gif animations Emacs starts spinning up 100% CPU even after the emacs browser is closed.  Emacs has to be completely shut down to reduce the CPU usuage.

If the 100% CPU process is allowed to run its course, it eventually stops after several minutes with the message, "Stopping animation; animation possibly too big".
   

In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.13, cairo version 1.16.0)
 of 2020-04-16 built on localhost.localdomain
Repository revision: d5a7df8c02f04102d50a5cd2290262f59f2b1415
Repository branch: master
Windowing system distributor 'Fedora Project', version 11.0.12006000
System Description: Fedora 31 (Thirty One)

Recent messages:
ad-handle-definition: ‘vc-revert’ got redefined
BBDB: sendmail insinuation deprecated.  Use mail.
Loading /home/francis/.emacs.d/recentf...done
Cleaning up the recentf list...done (0 removed)
Turning on magit-auto-revert-mode...done
For information about GNU Emacs and the GNU system, type C-h C-a.
Package cl is deprecated
Contacting host: bridgesense.com:443
ad-handle-definition: ‘open-network-stream’ got redefined
uncompressing publicsuffix.txt.gz...done

Configured using:
 'configure --without-makeinfo --with-gnutls=ifavailable
 --with-mailutils'

Configured features:
XPM JPEG TIFF GIF PNG CAIRO SOUND DBUS GSETTINGS GLIB NOTIFY INOTIFY
LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS PDUMPER GMP

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Dashboard

Minor modes in effect:
  general-override-mode: t
  global-auto-complete-mode: t
  global-magit-file-mode: t
  magit-auto-revert-mode: t
  global-git-commit-mode: t
  ranger-override-dired-mode: t
  recentf-mode: t
  page-break-lines-mode: t
  fancy-battery-mode: t
  global-git-gutter-mode: t
  which-key-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  csv-field-index-mode: t
  projectile-mode: t
  smooth-scrolling-mode: t
  global-flycheck-mode: t
  autopair-global-mode: t
  show-paren-mode: t
  ivy-mode: t
  helm-mode: t
  async-bytecomp-package-mode: t
  helm--remap-mouse-mode: t
  evil-commentary-mode: t
  global-evil-surround-mode: t
  evil-surround-mode: t
  global-evil-matchit-mode: t
  evil-matchit-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  shell-dirtrack-mode: t
  evil-mode: t
  evil-local-mode: t
  override-global-mode: t
  save-place-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow bbdb-message mail-extr emacsbug sendmail helm-command helm-elisp
helm-eval edebug backtrace helm-info jka-compr gnutls network-stream
url-cache winner whitespace magit-bookmark bookmark pp general
counsel-bbdb ac-html-bootstrap web-completion-data auto-complete-config
ac-php auto-complete ac-php-core popup xcscope f bbdb-vcard vcard
bbdb-mua bbdb-com bbdb bbdb-site timezone evil-magit helm-ls-git vc-git
vc vc-dispatcher magit-submodule magit-obsolete magit-blame magit-stash
magit-reflog magit-bisect magit-push magit-pull magit-fetch magit-clone
magit-remote magit-commit magit-sequence magit-notes magit-worktree
magit-tag magit-merge magit-branch magit-reset magit-files magit-refs
magit-status magit magit-repos magit-apply magit-wip magit-log
which-func magit-diff smerge-mode diff-mode magit-core magit-autorevert
magit-margin magit-transient magit-process magit-mode git-commit
transient magit-git magit-section magit-utils crm log-edit message
rfc822 mml mml-sec mm-decode mm-bodies mm-encode mailabbrev gmm-utils
mailheader pcvs-util with-editor server ranger autorevert filenotify
hl-line dired dired-loaddefs geben dbgp dashboard dashboard-widgets time
recentf tree-widget page-break-lines helm-ag helm-projectile pcase
spaceline-config spaceline-segments spaceline powerline
powerline-separators powerline-themes fancy-battery battery dbus
synosaurus define-word rng-nxml rng-valid rng-loc rng-uri rng-parse
nxml-parse rng-match rng-dt rng-util rng-pttrn nxml-ns nxml-mode
nxml-outln nxml-rap nxml-util nxml-enc xmltok url-http url-auth
mail-parse rfc2231 url-gw nsm rmc helm-flyspell ace-jump-mode cl
linum-relative linum display-line-numbers helm-tramp helm-swoop
gruvbox-dark-soft-theme gruvbox-theme gruvbox autothemer
git-gutter-fringe git-gutter fringe-helper which-key web-beautify
php-scratch s yasnippet rainbow-mode flycheck-color-mode-line face-remap
json-mode json-reformat json-snatcher csv-mode sort sass-mode haml-mode
js css-mode sgml-mode eww mm-url gnus nnheader gnus-util rmail
rmail-loaddefs rfc2047 rfc2045 ietf-drums mail-utils wid-edit mm-util
mail-prsvr url-queue url url-proxy url-privacy url-expand url-methods
url-history mailcap shr text-property-search url-cookie url-domsuf
url-util puny svg dom ruby-mode smie coffee-mode php-mode mode-local
imenu speedbar ezimage dframe etags fileloop generator xref project
add-log cc-langs cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles
cc-align cc-engine cc-vars cc-defs php-face php php-project projectile
grep ibuf-ext ibuffer ibuffer-loaddefs flymake-proc flymake compile
warnings xah-css-mode ido web-mode aggressive-indent smooth-scrolling
tramp tramp-loaddefs trampver tramp-integration files-x tramp-compat
parse-time iso8601 ls-lisp exec-path-from-shell multi-term term
disp-table ehelp ob-plantuml flycheck-plantuml flycheck plantuml-mode
xml dash org-bullets epa-file epa derived epg epg-config org-crypt org
ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-footnote
org-src ob-comint org-pcomplete org-list org-faces org-entities
time-date noutline outline org-version ob-emacs-lisp ob-core ob-eval
org-table ol org-keys org-compat org-macs org-loaddefs find-func
cal-menu calendar cal-loaddefs autopair paren swiper ivy delsel colir
color ivy-overlay helm-mode helm-files helm-buffers helm-occur helm-tags
helm-locate helm-grep helm-regexp format-spec helm-utils helm-help
helm-types helm-config helm-easymenu async-bytecomp helm helm-source
eieio-compat helm-multi-match helm-lib async evil-commentary
evil-commentary-integration evil-tutor evil-surround evil-matchit
evil-matchit-sdk evil evil-keybindings evil-integration undo-tree diff
evil-maps evil-commands reveal flyspell ispell evil-jumps
evil-command-window evil-types evil-search evil-ex shell pcomplete
comint ansi-color evil-macros evil-repeat evil-states evil-core advice
evil-common windmove thingatpt rect evil-digraphs evil-vars ring
diminish cl-extra help-mode use-package use-package-ensure
use-package-delight use-package-diminish use-package-bind-key bind-key
easy-mmode use-package-core finder-inf edmacro kmacro saveplace rx info
package easymenu browse-url url-handlers url-parse auth-source cl-seq
eieio eieio-core cl-macs eieio-loaddefs password-cache json subr-x map
url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
timer select scroll-bar mouse jit-lock font-lock syntax facemenu
font-core term/tty-colors frame minibuffer cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote threads dbusbind
inotify dynamic-setting system-font-setting font-render-setting cairo
move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 658790 47463)
 (symbols 48 53176 2)
 (strings 32 212837 9154)
 (string-bytes 1 7430431)
 (vectors 16 83039)
 (vector-slots 8 923611 44954)
 (floats 8 566 1005)
 (intervals 56 2849 206)
 (buffers 992 16))



Reply | Threaded
Open this post in threaded view
|

bug#40685: 28.0.50; eww browser chews up 100% cpu when displaying looping gif animations

Lars Ingebrigtsen
Francis Meetze <[hidden email]> writes:

> When opening a web page in the Emacs browser that contains infinite looping gif animations Emacs starts spinning up 100% CPU even after the emacs browser is closed.  Emacs has to be completely shut down to reduce the CPU usuage.
>
> If the 100% CPU process is allowed to run its course, it eventually stops after several minutes with the message, "Stopping animation; animation possibly too big".

Yeah, that triggers when it's taken more than two seconds to get the
next frame.  Emacs can be totally unusable for a long time, though,
because we may get a new frame faster than that, but leave no CPU for
the rest of Emacs.

Lowering the limit seems like an obvious solution, but that will make
many animations stop if Emacs is occasionally busy with something else.

So that simplistic test is error-prone and doesn't really help that much
with the problem.

I wonder whether a different heuristic could be written...  not
something that stops the animation if a single frame arrives too late,
but averaged over several frames.  That is, if frames consistently
arrive (way) too late, then it's probably using all the CPU, and should
stop.  Hm...  it doesn't seem to hard two write something like that, I
think?  I'll give it a go.

--
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



Reply | Threaded
Open this post in threaded view
|

bug#40685: 28.0.50; eww browser chews up 100% cpu when displaying looping gif animations

Lars Ingebrigtsen
Lars Ingebrigtsen <[hidden email]> writes:

>  Hm...  it doesn't seem to hard two write something like that, I
> think?  I'll give it a go.

I've now done so in Emacs 28, and it seems to work in my test cases with
huge GIFs.  It'll probably take some tweaking to find a limit that
doesn't stop legitimate animations, though.

--
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no