From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: MPS: a random backtrace while toying with gdb Date: Sun, 30 Jun 2024 09:16:00 +0300 Message-ID: <86tthbgdlr.fsf@gnu.org> References: <87bk3jh8bt.fsf@localhost> <867ce7hvvz.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7216"; mail-complaints-to="usenet@ciao.gmane.io" Cc: pipcet@protonmail.com, yantar92@posteo.net, emacs-devel@gnu.org, eller.helmut@gmail.com To: Gerd =?iso-8859-1?Q?M=F6llmann?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jun 30 08:16:51 2024 Return-path: Envelope-to: ged-emacs-devel@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 1sNnrm-0001fr-ET for ged-emacs-devel@m.gmane-mx.org; Sun, 30 Jun 2024 08:16:50 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNnr4-0007Nd-Ma; Sun, 30 Jun 2024 02:16:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNnr2-0007Mq-Dc for emacs-devel@gnu.org; Sun, 30 Jun 2024 02:16:04 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNnr1-00018o-Pk; Sun, 30 Jun 2024 02:16:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=AcGo1mgiIgYtFA6dpe7auHtRJs3owDWwSI+mQ0/DpTE=; b=hspEda77w4W6DQruCpiz +8UzzBlgylF2M5z7d3jp9MMiDPASj/vtHcJJdW2xibehy3L97Kn05rzZqKrR1ugKL/W5SjTCDLI81 t+9E59RU6EpeLdE93qqomtGKjYxfm6d8uWBJutJyWCumXvb31ytMH+TfmNQbPJEPwU52aYUWay4Vc lERM1lruu6YxBC75JsoJGaGSES5kPkKA+21v1wPOM1pRhLUfPlbsOQ+hF3cf8rg42VUPEEHAui9Fo X4C0NGXqCSfjM5NswvUsjB9erdO1f2o2IDQUbOuXbmVWgUx+veNGM0w7PNEW6vIXaA2MQD0q4g6E3 +O7WoTQwQFojeQ==; In-Reply-To: (message from Gerd =?iso-8859-1?Q?M=F6llmann?= on Sun, 30 Jun 2024 07:33:54 +0200) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:320918 Archived-At: > From: Gerd Möllmann > Cc: pipcet@protonmail.com, yantar92@posteo.net, emacs-devel@gnu.org, > eller.helmut@gmail.com > Date: Sun, 30 Jun 2024 07:33:54 +0200 > > Eli Zaretskii writes: > > >> Indeed > >> > >> #10 0x0000555555827385 in PSEUDOVECTORP (a=XIL(0x7fffeb90875d), code=9) at /home/yantar92/Git/emacs/src/lisp.h:1105 > >> #11 PROCESSP (a=XIL(0x7fffeb90875d)) at /home/yantar92/Git/emacs/src/process.h:212 > >> #12 XPROCESS (a=XIL(0x7fffeb90875d)) at /home/yantar92/Git/emacs/src/process.h:224 > >> #13 handle_child_signal (sig=sig@entry=17) at process.c:7660 > >> > >> Someone has an idea what to do with that? > > > > Call sigblock at the beginning of dflt_scan (and friends) and > > sigunblock before it returns? > > Yuk. Why "yuck"? That's a valid solution, IMO, especially if there are no better ones. I'm talking about blocking only a small number of signals: SIGCHLD, SIGPROF, SIGALRM, and maybe also SIGIO and SIGINT. (We should also consider SIGUSR1 and SIGUSR2.) > > Are there any guidance in the MPS docs for handling such signals in > > these situations? If not, can we ask them for guidance? It is > > unrealistic to expect any real-life program to do nothing in signal > > handlers except setting flags. And even flags could be subject to MPS > > moving GC, at least in some cases. So there must be some way of > > dealing with that in a safe way. > > It's Emacs' fault. MPS cannot reasonably be expected to assume that a > client program uses MPS managed memory in a signal handler. My 2 cents. That's unreasonable, IMNSHO. Programs manage memory for various purposes, and nothing in principle should prevent a program from accessing MPS-managed memory from a signal handler. Are you saying that a program that manages _all_ of its heap-allocated memory via MPS cannot also handle signals in a safe way? > >> And maybe how to reproduce? > > > > Run for enough time with subprocesses that start and terminate, I > > guess? > > Just remembered that I won't be able to reproduce this anyway an macOS, > where barriers don't use signals. AFAIU, this scenario is not necessarily related to barrier-related signals. SIGCHLD caused us to access MPS-managed memory, which violated some assertion in MPS, because the arena lock was already taken.