From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eval Exec Newsgroups: gmane.emacs.devel Subject: Re: [MPS-test] scratch/igc branch (commit: 42731228d24) crashed Date: Fri, 9 Aug 2024 00:56:25 +0800 Message-ID: References: <87plqnuekc.fsf@protonmail.com> <9d5pSofW1FhcAKO7fyf_c8hAwDE8aiuiDGWFglQZI-1FwaDY3KBS5zPkKt0nKUkzs0McRm9kHq47qZjzTz0rgfde5QfLH0v0KdgUxVXI6GA=@protonmail.com> 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="37575"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Pip Cet Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Aug 08 20:27:58 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 1sc7rh-0009Yw-Hr for ged-emacs-devel@m.gmane-mx.org; Thu, 08 Aug 2024 20:27:57 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sc7r0-00004x-V3; Thu, 08 Aug 2024 14:27: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 1sc6RM-0000Kc-2H for emacs-devel@gnu.org; Thu, 08 Aug 2024 12:56:40 -0400 Original-Received: from mail-oo1-xc44.google.com ([2607:f8b0:4864:20::c44]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sc6RK-0002pa-Dc for emacs-devel@gnu.org; Thu, 08 Aug 2024 12:56:39 -0400 Original-Received: by mail-oo1-xc44.google.com with SMTP id 006d021491bc7-5d5b986a806so1033247eaf.1 for ; Thu, 08 Aug 2024 09:56:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723136197; x=1723740997; darn=gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=JLdw6yrsrHS0R6m+GNZo7rBk6rcOIOoOBFjpgvCP8dY=; b=SVZJIsX55u5AUxrT4rEwWxmA3YO9RcyjEYQjdOybHDhL1TETn8AAu80ZREjtRn/jDb ebaziorpOPoYXMGScAoXR47H5IB9ZNNEl0Hl/aodCgVC0hv9yOH+SUmX6RRDYurYUcv6 5YPj02AOz2DgLUE1GoOY4VJeooDgN0gWbBVNyBndWJwEW3zafmpi6Fz5oNhVS5iuoBrf BgEu8STRvEy6SFRDxmAYi6JO+q5C5Tp6zE1uTvtwCtoZVHnXRH6LIhFo33iwcxzyQOdF 2Pcg7uOn2V0n0saWfnlBwMfYYfWQjip8fIcx0g1KpfBiflUbzaZcA9iB4jfhSdeR+WUb Yk+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723136197; x=1723740997; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JLdw6yrsrHS0R6m+GNZo7rBk6rcOIOoOBFjpgvCP8dY=; b=OHDQptUqq1QhYmGQ5OAX6tNcrjKiL8culmoLqHLr73tlASv3zFDsVHbnP3ICELeKO5 HH+zSiUsFPnp0vCodRiJ+aQ2nMlAQwsYNEX1vu/skDZFh03emdMMgKegf45Z50G62JX7 TYgScmZuSz2apSjdI2bw1Cq9McraSY/qr+NWjF53/areHn58HnI9kGIJBSnj96FTl/JG 8aGlUOUyVCpWutNCdjrrceZmPDdxTR41Ln/DhUgb0MM+f6vL+Y6KUKgOT27ZSgeQe66q FkK1VEF7WdO+SteEgf/QMldtb05P3+LOOAVx3nW2xIYJutGVsr71HUk4/64Ja+AyO56Y S4XQ== X-Gm-Message-State: AOJu0YxyN//bbeAYi7XzV1Xc3h63BN8SS/fPWLvi85Aef0bDGvaxOSqr xx2PX0eKcxN3XdFEfsu0IGsUfEz7dGEpQYWrMSJm1yrzi3iendy0mgIP4xSVuYWVtCNTlqt6lAX BNNfmbk1YxydrBMQ8FO88fNWeqbKq6CgDrBTl5Q== X-Google-Smtp-Source: AGHT+IH+6bMKO76DJzIsffzPIcjL2zwcYeEvm/QM4CCReMGNjuai3oXd5MovQNdakxlefcCPVKTGkY0B8XDRHz/vQKQ= X-Received: by 2002:a05:6808:124e:b0:3d9:42b1:6035 with SMTP id 5614622812f47-3dc3c192d66mr816849b6e.18.1723136196664; Thu, 08 Aug 2024 09:56:36 -0700 (PDT) In-Reply-To: <9d5pSofW1FhcAKO7fyf_c8hAwDE8aiuiDGWFglQZI-1FwaDY3KBS5zPkKt0nKUkzs0McRm9kHq47qZjzTz0rgfde5QfLH0v0KdgUxVXI6GA=@protonmail.com> Received-SPF: pass client-ip=2607:f8b0:4864:20::c44; envelope-from=execvy@gmail.com; helo=mail-oo1-xc44.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-Mailman-Approved-At: Thu, 08 Aug 2024 14:27:13 -0400 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:322542 Archived-At: Hello, I apply the patch into `42731228d24c37edb2dc848c3a74d5c932a817ef`, Then build emacs by: ```bash make extraclean ./autogen.sh \ && ./configure \ --prefix=3D$(realpath ../emacs-build/$(git branch --show-current | sed 's/\//_/g'))\ --with-mps \ --with-imagemagick \ --with-modules --with-x-toolkit=3Dlucid --without-compress-install \ --without-toolkit-scroll-bars --with-native-compilation --with-mailutils= \ --with-tree-sitter --with-xinput2 \ --with-dbus --with-native-compilation=3Daot \ --with-file-notification=3Dinotify\ && make -j20 install ``` Thanks for your work, emacs hasn't crashed anymore. On Tue, Aug 6, 2024 at 12:41=E2=80=AFAM Pip Cet wro= te: > > On Monday, August 5th, 2024 at 16:20, Pip Cet wro= te: > > "Eval Exec" execvy@gmail.com writes: > > > > > I wanted to help test the scratch/igc branch, so I compiled it from > > > commit 42731228d24. > > > > Thank you for doing that! > > > > > Then I build it by > > > ```bash > > > make extraclean > > > ./autogen.sh \ > > > && ./configure \ > > > --prefix=3D$(realpath ../emacs-build)\ > > > --with-mps \ > > > --with-imagemagick \ > > > --with-modules --with-x-toolkit=3Dlucid --without-compress-install \ > > > --without-toolkit-scroll-bars --with-native-compilation --with-mailut= ils\ > > > --with-tree-sitter --with-xinput2 \ > > > --with-dbus --with-native-compilation=3Daot \ > > > --with-file-notification=3Dinotify\ > > > && make -j20 install > > > > > > Like Eli, I'm suspecting the Lucid widget code... > > > > > It works perfectly for the first hour, but then it crashes, and I > > > don't know how to reproduce the issue. > > > > > > I think the crash is caused by "window size adjustments" > > > ``` > > > (gdb) bt > > > #0 0x00007f47afea2efc in __pthread_kill_implementation () from > > > /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so= .6 > > > #1 0x00007f47afe52e86 in raise () from > > > /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so= .6 > > > #2 0x00000000004243a4 in terminate_due_to_signal (sig=3Dsig@entry=3D8= , > > > backtrace_limit=3Dbacktrace_limit@entry=3D40) at emacs.c:470 > > > #3 0x00000000004248fc in handle_fatal_signal (sig=3Dsig@entry=3D8) at= sysdep.c:1800 > > > #4 0x000000000056f568 in deliver_thread_signal (sig=3D8, > > > handler=3D0x4248f1 ) at sysdep.c:1792 > > > #5 0x000000000056f669 in deliver_fatal_thread_signal (sig=3D > > out>) at sysdep.c:1812 > > > #6 > > > #7 0x000000000069e35e in pixel_to_char_size > > > (pixel_width=3Dpixel_width@entry=3D482, > > > pixel_height=3Dpixel_height@entry=3D76, > > > char_width=3Dchar_width@entry=3D0x7ffced20da38, > > > char_height=3Dchar_height@entry=3D0x7ffced20da3c, > > > ew=3D) at widget.c:172 > > > > > > That code reads: > > > > static void > > pixel_to_char_size (EmacsFrame ew, Dimension pixel_width, > > Dimension pixel_height, int *char_width, int *char_height) > > { > > struct frame *f =3D ew->emacs_frame.frame; > > > > > > *char_width =3D FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, (int) pixel_width); > > *char_height =3D FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, (int) pixel_heigh= t); > > } > > > > Which gets a frame pointer from a structure (ew) that MPS doesn't know > > about; but frames can move, so that explains the bug, because MPS > > doesn't know to update the pointer in the EmacsFrame structure. > > > > Unfortunately, the structure is allocated by XtCreateWidget, which call= s > > malloc(), IIUC. So it's not immediately obvious (to me) how to fix it. > > My best idea so far is to create an ambiguous root covering the frame > > pointer and store that in the structure instead. > > So I've done that, can you try the attached patch? This is a first stab (= thus the ambiguous alloc), but it should prevent the crash we've seen. > > TODO list for this: > - use precise alloc > - check framep, not *framep, in EmacsFrameInitialize > > Pip