From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Phil Sainty Newsgroups: gmane.emacs.bugs Subject: bug#42931: 27.1; json-pretty-print-buffer on ~2MB line causes core dump Date: Thu, 20 Aug 2020 01:50:55 +1200 Message-ID: <0b9da4d7-ca24-8e00-d49f-7630e42abe89@orcon.net.nz> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23721"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 To: 42931@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Aug 19 15:53:08 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k8OWZ-0005zR-R4 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 19 Aug 2020 15:53:07 +0200 Original-Received: from localhost ([::1]:45144 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k8OWY-0007x7-TC for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 19 Aug 2020 09:53:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34316) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8OVW-00070a-MB for bug-gnu-emacs@gnu.org; Wed, 19 Aug 2020 09:52:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55335) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k8OVW-0003cg-BJ for bug-gnu-emacs@gnu.org; Wed, 19 Aug 2020 09:52:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1k8OVW-0006Gc-Aa for bug-gnu-emacs@gnu.org; Wed, 19 Aug 2020 09:52:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Phil Sainty Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 19 Aug 2020 13:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 42931 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.159784506924012 (code B ref -1); Wed, 19 Aug 2020 13:52:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 19 Aug 2020 13:51:09 +0000 Original-Received: from localhost ([127.0.0.1]:38645 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k8OUe-0006FE-Fl for submit@debbugs.gnu.org; Wed, 19 Aug 2020 09:51:09 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:46528) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k8OUZ-0006Ez-32 for submit@debbugs.gnu.org; Wed, 19 Aug 2020 09:51:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34100) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8OUY-0005Ib-NZ for bug-gnu-emacs@gnu.org; Wed, 19 Aug 2020 09:51:02 -0400 Original-Received: from smtp-2.orcon.net.nz ([60.234.4.43]:47493) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8OUV-0003XJ-VV for bug-gnu-emacs@gnu.org; Wed, 19 Aug 2020 09:51:02 -0400 Original-Received: from [101.53.216.96] (port=27757 helo=[192.168.20.103]) by smtp-2.orcon.net.nz with esmtpa (Exim 4.90_1) (envelope-from ) id 1k8OUQ-0003O3-LE for bug-gnu-emacs@gnu.org; Thu, 20 Aug 2020 01:50:55 +1200 Content-Language: en-GB X-GeoIP: NZ Received-SPF: pass client-ip=60.234.4.43; envelope-from=psainty@orcon.net.nz; helo=smtp-2.orcon.net.nz X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/19 08:52:16 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:185607 Archived-At: (I presume this is to do with the native JSON support, as Emacs 26.3 copes fine with the same command on the example files.) Using the example JSON file from https://emacs.stackexchange.com/questions/598/how-do-i-prevent-extremely-long-lines-making-emacs-slow which you can fetch with: wget https://github.com/Wilfred/ReVo-utilities/blob/a4bdc40dd2656c496defc461fc19c403c8306d9f/revo-export/dictionary.json?raw=true -O one_line.json and then safely open in Emacs 27 with: emacs -Q -f global-so-long-mode one_line.json C-x C-q to make the buffer writeable. M-x json-pretty-print-buffer On my system, Emacs hangs for quite a while and then core dumps. That's an 18MB line. If I trim it down to ~2MB I still see the same thing. You can do that with (write-region 1 2000151 "two_mb.json") and then appending a single '}' at the end of the new file to make it valid JSON. If I trim back to ~1MB the command succeeds. (write-region 1 1000088 "one_mb.json") and then append '}]}}' The smaller files are a bit nicer for comparisons with Emacs 26.3, which *does* cope with the 18MB file, but processes the smaller ones much faster (and much faster than it takes Emacs 27.1 to fail). I also note that, when forgetting to toggle the read-only buffer state first, Emacs 26.3 immediately issues the "json-pretty-print: Buffer is read-only" error, whereas Emacs 27.1 evidentially tries to do all the work, and (for a file small enough to not cause it to crash in the process) only notices the buffer read-only state once it tries to replace the contents "replace-region-contents: Buffer is read-only". -Phil p.s. If you're unable to replicate this and wish me to use gdb, please give step by step instructions for the entire process. In GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 2020-08-12 built on shodan Windowing system distributor 'The X.Org Foundation', version 11.0.12008000 System Description: Ubuntu 18.04.5 LTS Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Quit [2 times] Loading json...done delete-backward-char: Text is read-only [2 times] Quit [2 times] Mark activated Configured using: 'configure --prefix=/home/phil/emacs/27.1/usr/local --with-x-toolkit=lucid --without-sound' Configured features: XAW3D XPM JPEG TIFF GIF PNG RSVG DBUS GSETTINGS GLIB NOTIFY INOTIFY GNUTLS LIBXML2 FREETYPE HARFBUZZ XFT ZLIB TOOLKIT_SCROLL_BARS LUCID X11 XDBE XIM MODULES THREADS JSON PDUMPER LCMS2 GMP Important settings: value of $LANG: en_NZ.UTF-8 locale-coding-system: utf-8-unix Major mode: Dired by name Minor modes in effect: tooltip-mode: t global-eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-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 sort mail-extr json map emacsbug message rmc puny format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg epg-config gnus-util rmail rmail-loaddefs text-property-search time-date subr-x seq byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils dired dired-loaddefs advice 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 lcms2 dynamic-setting system-font-setting font-render-setting x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 50018 10992) (symbols 48 6273 1) (strings 32 17137 1060) (string-bytes 1 545762) (vectors 16 9965) (vector-slots 8 132814 16180) (floats 8 26 42) (intervals 56 300 0) (buffers 1000 14))