From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#23912: 25.0.95; Abort in gc when working with streams Date: Thu, 14 Jul 2016 17:58:47 +0300 Message-ID: <83h9bs8dw8.fsf@gnu.org> References: <87wpkxtmwg.fsf@web.de> <83poqpjro0.fsf@gnu.org> <87oa6973hi.fsf@web.de> <7dcd2856-b9a4-9516-607a-1109d2be2dbc@yandex.ru> <874m81qj9t.fsf@web.de> <83a8hsk662.fsf@gnu.org> <87eg6y8qw4.fsf@web.de> <83oa618far.fsf@gnu.org> <87d1mhb5bc.fsf@web.de> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1468509019 29816 80.91.229.3 (14 Jul 2016 15:10:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 14 Jul 2016 15:10:19 +0000 (UTC) Cc: 23912@debbugs.gnu.org To: Michael Heerdegen , Richard Stallman Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jul 14 17:10:04 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bNiH4-0002OB-Pf for geb-bug-gnu-emacs@m.gmane.org; Thu, 14 Jul 2016 17:10:03 +0200 Original-Received: from localhost ([::1]:54676 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNiH0-0007sa-KJ for geb-bug-gnu-emacs@m.gmane.org; Thu, 14 Jul 2016 11:09:58 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48058) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNi7T-00057f-5u for bug-gnu-emacs@gnu.org; Thu, 14 Jul 2016 11:00:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bNi7O-0003uA-VO for bug-gnu-emacs@gnu.org; Thu, 14 Jul 2016 11:00:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:39226) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNi7O-0003tv-Qs for bug-gnu-emacs@gnu.org; Thu, 14 Jul 2016 11:00:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bNi7O-0003Ag-Kk for bug-gnu-emacs@gnu.org; Thu, 14 Jul 2016 11:00:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 14 Jul 2016 15:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23912 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 23912-submit@debbugs.gnu.org id=B23912.146850835812108 (code B ref 23912); Thu, 14 Jul 2016 15:00:02 +0000 Original-Received: (at 23912) by debbugs.gnu.org; 14 Jul 2016 14:59:18 +0000 Original-Received: from localhost ([127.0.0.1]:51563 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bNi6f-00039E-NN for submit@debbugs.gnu.org; Thu, 14 Jul 2016 10:59:17 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:56884) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bNi6e-000392-GI for 23912@debbugs.gnu.org; Thu, 14 Jul 2016 10:59:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bNi6W-0003eK-A3 for 23912@debbugs.gnu.org; Thu, 14 Jul 2016 10:59:11 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:44545) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNi6W-0003eD-6H; Thu, 14 Jul 2016 10:59:08 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1753 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bNi6N-0004I6-M9; Thu, 14 Jul 2016 10:59:00 -0400 In-reply-to: <87d1mhb5bc.fsf@web.de> (message from Michael Heerdegen on Wed, 13 Jul 2016 23:23:35 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:121067 Archived-At: > From: Michael Heerdegen > Cc: 23912@debbugs.gnu.org > Date: Wed, 13 Jul 2016 23:23:35 +0200 > > Eli Zaretskii writes: > > > > From: Michael Heerdegen > > > Cc: 23912@debbugs.gnu.org > > > Date: Tue, 12 Jul 2016 23:53:31 +0200 > > > > > > #0 0x00007ffff1930c19 in raise () from > > > /lib/x86_64-linux-gnu/libpthread.so.0 > > > #1 0x000000000054d2fe in terminate_due_to_signal (sig=6, > > > backtrace_limit=40) at emacs.c:381 > > > #2 0x00000000005715d9 in emacs_abort () at sysdep.c:2247 > > > #3 0x00000000005c9c1d in garbage_collect_1 (end=0x7fffffff5868) at > > > alloc.c:5662 > > > #4 0x00000000005ca55d in Fgarbage_collect () at alloc.c:5979 > > > #5 0x000000000054afbc in maybe_gc () at lisp.h:4654 > > > > I don't understand how this could have happened. The only place that > > sets abort_on_gc true is prin1-to-string, but it is not in the > > backtrace. So somehow that setting was not reset at the end of > > prin1-to-string, and it looks like the only way that could have > > happened is if some code triggered by prin1-to-string set > > throw-on-input or called while-no-input. Is this likely to have > > happened during what you did? > > Yes, it's very likely. Richard, do you perhaps remember, or can try to second-guess, why do we set the abort_on_gc flag inside prin1-to-string? I mean this fragment of print.c: /* Save and restore this: we are altering a buffer but we don't want to deactivate the mark just for that. No need for specbind, since errors deactivate the mark. */ Lisp_Object save_deactivate_mark = Vdeactivate_mark; bool prev_abort_on_gc = abort_on_gc; abort_on_gc = true; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Lisp_Object printcharfun = Vprin1_to_string_buffer; PRINTPREPARE; print (object, printcharfun, NILP (noescape)); /* Make Vprin1_to_string_buffer be the default buffer after PRINTFINISH */ PRINTFINISH; struct buffer *previous = current_buffer; set_buffer_internal (XBUFFER (Vprin1_to_string_buffer)); object = Fbuffer_string (); if (SBYTES (object) == SCHARS (object)) STRING_SET_UNIBYTE (object); /* Note that this won't make prepare_to_modify_buffer call ask-user-about-supersession-threat because this buffer does not visit a file. */ Ferase_buffer (); set_buffer_internal (previous); Vdeactivate_mark = save_deactivate_mark; abort_on_gc = prev_abort_on_gc; Why do we want to prevent GC while working on Vprin1_to_string_buffer? It's just a buffer, and AFAICT we just collect the printed stuff there. And yet this code that tries to avoid GC was there since long ago, first as GCPRO, and now as this flag. What bad things could happen if we just remove it?