From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Gerd_M=C3=B6llmann?= Newsgroups: gmane.emacs.devel Subject: Re: MPS make-thread Date: Sun, 23 Jun 2024 05:18:06 +0200 Message-ID: References: <87v823xvq1.fsf@localhost> <87msne3flr.fsf@gmail.com> <87frt63dvt.fsf@gmail.com> <86o77ulgk8.fsf@gnu.org> <87zfre1p3r.fsf@gmail.com> <87zfreo5u6.fsf@localhost> <87plsa1n8k.fsf@gmail.com> <87wmmio3vq.fsf@localhost> <87jzii1hbs.fsf_-_@gmail.com> <8734p61evv.fsf@gmail.com> <87cyoa3w5d.fsf@localhost> <87le2whkt2.fsf@localhost> <86sex4g53k.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18534"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Ihor Radchenko , eller.helmut@gmail.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jun 23 05:19:06 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 1sLDkw-0004ev-Pz for ged-emacs-devel@m.gmane-mx.org; Sun, 23 Jun 2024 05:19:06 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sLDk7-0005ax-Ca; Sat, 22 Jun 2024 23:18:15 -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 1sLDk5-0005aI-TA for emacs-devel@gnu.org; Sat, 22 Jun 2024 23:18:13 -0400 Original-Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sLDk4-0007XW-6k; Sat, 22 Jun 2024 23:18:13 -0400 Original-Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2eaafda3b5cso34455061fa.3; Sat, 22 Jun 2024 20:18:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719112688; x=1719717488; darn=gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OXUxKmobx9OiLDS+O9+gVwqNmhLRYIEZH4NzDBlurp8=; b=nma+ZYBbk5Ce7LxJ2pF38hnlevXkTf5cvUDbdkvMu/XxY13Lv5yp53GZsHtNgSlgXp blX11fkDCKsnsdYcoMyZRL6YkxjAUszsivVuJlakLmEgmt7YaKgP8m62juiElG/wkozf U1NbR7VBSP7XdVr5k9Ru3L4PbaN1ljp3dK68GXas9pd8uFZuQLlqXXTpKVtcHjy5BZyl DNyvmQmd36JbnzA9LQk9ISlCLJ2LJo5dCO58gysZbcrpuZjJD3z0LTBbBgjaZaxLvbcj Pc4UGX6bIZDQA31QbisZNbPm93hihxDfMhp/49iE7CBoiWXnhN4grhFSM8+dQIPHgs26 MnMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719112688; x=1719717488; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=OXUxKmobx9OiLDS+O9+gVwqNmhLRYIEZH4NzDBlurp8=; b=fwa3wbpii0DwLkVJPbRMTGZvG/BATbIvg5feJoLErv0ad6rRNnLr9DsA3mmaD/QO20 EdUv//2xRUIjRo5r+PY7kD0PTggdgxsXBccRgzY5yo0RlavkquPywUcHSGCkvuK0t8Zt hZiWBwi4tI51QUOG/OSGxF5bRpZUT58mQzg4JBYn+UQdALpN2zz4GS8oytHKuR1fvrCW i1XqL9o0UQPVqYDewWeeaIi9+pQxPk/mXOgJsvnpkFD95LjXL+s6vIilQSWIbVz1arnL F81EQlVDBqTmq4DhaBbZbfosmqS32r+bqx9bxWeowJmMqQWeg5a+nPDKaKkj1s2nT7e7 wAFA== X-Forwarded-Encrypted: i=1; AJvYcCWzqLDG2mVbyIA4o9gZqMfIJ9bjPWD8YFCdzLWXznY5N7ERxd6rKTq/Oae/vIjCtQDKXkIXnb0KQdLxWblrQCCamZPW X-Gm-Message-State: AOJu0YzMSZaA8zTNy25YlZzOdUAFfvV52RS3mmOZCEG0F5mqbqPtcUYP g1GH+TEUotWh+Sj88ut78CctN2VZDk9RK91k0TVa8+g8wd5T5OESewBjxQ== X-Google-Smtp-Source: AGHT+IFmvEmHbPdMVW/R/JWuQVfxi9IYNXGAkbbKvUpZGiQKG+Kw1t//J5c8LA3tGB+IZIoxvu0xhw== X-Received: by 2002:a05:6512:31c9:b0:52c:99c9:bef6 with SMTP id 2adb3069b0e04-52ce063e3bdmr1171598e87.7.1719112688082; Sat, 22 Jun 2024 20:18:08 -0700 (PDT) Original-Received: from pro2.fritz.box (p4fe3abd0.dip0.t-ipconnect.de. [79.227.171.208]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6fcf56c484sm257484366b.195.2024.06.22.20.18.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Jun 2024 20:18:07 -0700 (PDT) In-Reply-To: <86sex4g53k.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 22 Jun 2024 22:17:03 +0300") Received-SPF: pass client-ip=2a00:1450:4864:20::22a; envelope-from=gerd.moellmann@gmail.com; helo=mail-lj1-x22a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:320492 Archived-At: Eli Zaretskii writes: >> From: Ihor Radchenko >> Cc: Helmut Eller , Eli Zaretskii , >> emacs-devel@gnu.org >> Date: Sat, 22 Jun 2024 18:52:25 +0000 >>=20 >> Gerd M=C3=B6llmann writes: >>=20 >> >> thix.c:67: Emacs fatal error: assertion failed: SigCheck Thread: thre= ad >> >> Fatal error 6: Aborted >> > >> > Any chance to make this reproducible? Maybe by adding calls to >> > (igc--collect) in various places? I don't know what you are doing... >>=20 >> (progn >> (defvar *baz* nil) >> (defun bar (len) >> (let ((data (make-list len nil))) >> (setq *baz* (lambda () (bar len) data)))) >> (defun foo () >> (bar 1000) >> (dotimes (_ 10000) >> (funcall *baz*))) >> (thread-join (make-thread (lambda () (igc--collect)))) >> (foo)) > > I get a crash only after running this several times. It looks like > this: > > ss.c:66: Emacs fatal error: assertion failed: warmest < stackCold AFAIR, MPS calls the bottom of a control stack "cold". Warmest could then be the other end of the stack. And that's x86, so the stack grows down to lower addresses, so that could make sense. Just guessing of course. > lockw3.c:98: Emacs fatal error: assertion failed: lock->claims =3D=3D 0 And the typical followup crash from using MPS when it already has crashed. > #27 StackScan (ss=3D0x1fc5fb70, stackCold=3D0x1edeff28, scan_area=3D0x2= c11f9 , closure=3D0x0) at ss.c:66 > #28 0x003c7494 in RootScan (ss=3Dss@entry=3D0x1fc5fb70, root=3Droot@ent= ry=3D0xa60e83c) at root.c:577 > #29 0x003c7d1d in traceScanRootRes (ts=3Dts@entry=3D1, rank=3Drank@entr= y=3D0, arena=3Darena@entry=3D0x7100000, root=3Droot@entry=3D0xa60e83c) at t= race.c:528 > #30 0x003c8118 in traceScanRoot (root=3D0xa60e83c, arena=3D0x7100000, r= ank=3D0, ts=3D1) at trace.c:545 No further clue from the backtrace. > We must do something about these assertions: when there's an assertion > violation caused by a thread which was started by MPS, we cannot call > shut_down_emacs in that thread's context, for obvious reasons. We > must instead set some flag which will cause the main thread or one of > the other Lisp threads call shut_down_emacs. The MPS documentation > says: > > Warning: The installed assertion handler must not call any > function in MPS, and it must not access memory managed by the > MPS. > > But our handler, igc_assert_fail, does exactly what they say not to > do. I know. See the comment above that function. One idea might be to set aside a block of memory for use when we know that MPS is unusable. Then, make alloc_impl allocate from that block, and probably we must put MPS in postmortem state. Or maybe we can just use malloc in alloc_impl.=20 I think one should try something like that so that Emacs can do its thing as usual in such cases. Can of course fail, and will certainly be fiddly. I currently don't have the energy to do that. > And what does "warmest < stackCold" mean, in human-understandable > terms, anyway? At night it's colder than outside :-). Who knows?