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: out-of-memory Date: Mon, 08 Jul 2024 20:26:56 +0200 Message-ID: References: <86a5iu4tiy.fsf@gnu.org> <87msmu1uy5.fsf@gmail.com> <865xtg14hd.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21060"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , acorallo@gnu.org, eller.helmut@gmail.com, emacs-devel@gnu.org To: Pip Cet Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Jul 08 20:27:55 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 1sQt5e-0005Ik-Vg for ged-emacs-devel@m.gmane-mx.org; Mon, 08 Jul 2024 20:27:54 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sQt4v-0006nK-Eo; Mon, 08 Jul 2024 14:27:09 -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 1sQt4p-0006lg-S6 for emacs-devel@gnu.org; Mon, 08 Jul 2024 14:27:03 -0400 Original-Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sQt4m-0001B7-WE; Mon, 08 Jul 2024 14:27:02 -0400 Original-Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-57ccd1111aeso5637811a12.0; Mon, 08 Jul 2024 11:26:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720463218; x=1721068018; darn=gnu.org; h=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=arcCs3vl4prp5JRr5r6cowa2NBHmDA7B1qfC/FRuQNg=; b=jY7CgEGaheeEe9BXAUU7zmEmMvkAK4+gad6/OiPrkMtzdOJGJdEB58HLLgy1emPSl9 ZJaynvrTMB6oWwG3vaPU15GUlq0+ub2Uzh5U6nQxZaknufrAz6mtlEFqp8ryqh7oUALe xXNtKSHFRTY0Ve8UAiINYmXQMV87d+NBQbKOTVPXH67Zz6AvT+FJJIBLxfvRQm/KRPPl 1/HTA8fkFxiv7XUExsw5R/6wBl5sMCh/GYO8graeFZymTOkDMHgnaTQfFsuMhNwflZi/ 2C0UJFTcHAuSaIqHNoeNKo3YiUZxoq0Izs7Pn15DHiRqfIWBYkK/EgMHt+DbQg1fHgRA 5oCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720463218; x=1721068018; h=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=arcCs3vl4prp5JRr5r6cowa2NBHmDA7B1qfC/FRuQNg=; b=LgaLdcsnMdztYhbPmKxVgYj93voXDyhdr8uGfS0MNqW8xIHzRNdFay79UnB9+dmeSp kVpNOR22veH2MQQPQohrcijvuz2dx+/M088skyR8Ggb9gRIquRbfUVxG+chGrRo/kAqD FnJ7L0jckZ/dQq/TiykfLN+A4sdkBEgkUkrLLNjJdMhQveZ462xb6D6+1HrgAUkcf0xG ivrckgLpkgbb8cY8u+g7QT3oso9DDmdhIJm9ZuTMO1ObceilRpIjmaTkFR7g7MS4eUbA swJfDxuMnG880Y8nG4vW3Z7t5D7ZRbpfRXyB1BiCjue6yb/hvGB4N2vuOrJyAkU+b+Ev WBPg== X-Forwarded-Encrypted: i=1; AJvYcCUaQEZjtqQa9+kBLEkl8XCkLWandsO/pFkT4KQ4kuPitT8KdTkFB5ZF9I0Z9n1fh79n9hn3D4n4a73qkgh3j0OZzUjVHre8YVYiUZUeNmLbrG5vI2Tg X-Gm-Message-State: AOJu0YxBucqykltW+ymPbJ6PIQVrwHvSh1HoSR/MXhkmSuRKJv6A+1Cn OVsmxYXXev2DsLkBT6d8YTxVJHbtlJ1yrCCGvJ84mlr0N7myfg5SydrKng== X-Google-Smtp-Source: AGHT+IHHt9FA85L+DNPFHouthsb6w3r+0kLsGvzt0cn9paZc6OLlQ8kLN8pFVtTKaKA/17ewspoWjA== X-Received: by 2002:aa7:d6c8:0:b0:57c:6740:f47c with SMTP id 4fb4d7f45d1cf-594bc7c7e56mr208198a12.27.1720463218056; Mon, 08 Jul 2024 11:26:58 -0700 (PDT) Original-Received: from pro2.fritz.box (p4fe3a2f7.dip0.t-ipconnect.de. [79.227.162.247]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-594bd459af1sm115089a12.59.2024.07.08.11.26.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jul 2024 11:26:57 -0700 (PDT) In-Reply-To: (Pip Cet's message of "Mon, 08 Jul 2024 16:45:20 +0000") Received-SPF: pass client-ip=2a00:1450:4864:20::52f; envelope-from=gerd.moellmann@gmail.com; helo=mail-ed1-x52f.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:321545 Archived-At: Pip Cet writes: >> Yes, I think that's important, and also handling the case of getting >> errors codes from MPS in general. > > I think we might want to distinguish the two cases: MPS might die, > sure, but it looks like we need an out-of-memory mechanism separate > from MPS to avoid assertion violations. Could you please elaborate which assertions these are? > >> As one can see, igc as a whole is in a certain state, igc_state. The >> idea is that the state changes to IGC_STATE_DEAD when something fatal >> happens. In that state, malloc is used is used for allocating Lisp >> objects instead of MPS. That lets Emacs shut down gracefully without >> entering MPS recursively as it was before I added the state. > > I've seen that work, and I've seen it not work. Better than nothing > :-) Right, if you have such a case that I can reproduce, please holler :-) >> Such state changes are currently done when checking the return code of >> an MPS API function and when assertions fail. >> >> Seems to work as expected, as I could see in a couple of backtraces from >> Ihor I believe showing the set_state (IGC_STATE_DEAD), and from my own >> experience. But maybe someone has an idea how to improve it. > > If I understood Helmut correctly, he wants a mechanism to avoid > thrashing after exceeding the memory limit. Maybe we need a special > state for that, in which we stop the GC but continue using our memory > while the user quits and goes to buy more RAM? Could be. One could for example allocate a block from MPS that we make available to MPS as a first aid. I think that would be relatiely easy. Using xzalloc in IGC_STATE_DEAD was just easiest to implement for me. I was mainly trying to make the error handling in igc understandable. I think introducing the states was not too bad for that. Also for that non-error state because of the staticpros, which becomes much clearer that way, I believe. Anyway. > Speaking of memory issues in general, I'm currently seeing pure space > overflows, after changes which should affect weak objects exclusively. > Which is really odd, because weak objects aren't purecopied! Still > investigating that one, but it's possible I'll just give up and bump > pure space. > > In any case, we end up segfaulting because we still try to run GC > after pure space overflowed. I'll push a fix for that, but I can't > promise to test the case of overflowing pure space very much. Once more time glad that I don't have pure space here :-). (I think I've picked what I want to play with next today, BTW. https://github.com/actor-framework/actor-framework :-)