all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: gerd.moellmann@gmail.com, eller.helmut@gmail.com, emacs-devel@gnu.org
Subject: Re: MPS make-thread
Date: Sat, 22 Jun 2024 22:17:03 +0300	[thread overview]
Message-ID: <86sex4g53k.fsf@gnu.org> (raw)
In-Reply-To: <87le2whkt2.fsf@localhost> (message from Ihor Radchenko on Sat, 22 Jun 2024 18:52:25 +0000)

> From: Ihor Radchenko <yantar92@posteo.net>
> Cc: Helmut Eller <eller.helmut@gmail.com>, Eli Zaretskii <eliz@gnu.org>,
>  emacs-devel@gnu.org
> Date: Sat, 22 Jun 2024 18:52:25 +0000
> 
> Gerd Möllmann <gerd.moellmann@gmail.com> writes:
> 
> >> thix.c:67: Emacs fatal error: assertion failed: SigCheck Thread: thread
> >> 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...
> 
> (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

  lockw3.c:98: Emacs fatal error: assertion failed: lock->claims == 0

  Thread 11 received signal SIGTRAP, Trace/breakpoint trap.
  [Switching to Thread 9512.0x10a08]
  0x774996c3 in KERNELBASE!DebugBreak () from C:\WINDOWS\SysWOW64\KernelBase.dll
  (gdb) thread apply all bt

  Thread 11 (Thread 9512.0x10a08):
  #0  0x774996c3 in KERNELBASE!DebugBreak () from C:\WINDOWS\SysWOW64\KernelBase.dll
  #1  0x002e457c in emacs_abort () at w32fns.c:11279
  #2  0x00194ca0 in terminate_due_to_signal (sig=sig@entry=22, backtrace_limit=backtrace_limit@entry=2147483647) at emacs.c:481
  #3  0x002c2ebc in igc_assert_fail (file=0x7b304d <__mon_yday+4429> "lockw3.c", line=98, msg=0x7b9a5c <__mon_yday+31580> "lock->claims == 0") at igc.c:181
  #4  0x0039c18d in mps_lib_assert_fail (condition=0x7b9a5c <__mon_yday+31580> "lock->claims == 0", line=98, file=0x7b304d <__mon_yday+4429> "lockw3.c") at mpsliban.c:87
  #5  LockClaim (lock=0xa5560c8) at lockw3.c:98
  #6  0x0039c2e5 in ArenaEnterLock (arena=arena@entry=0x7100000, recursive=recursive@entry=0) at global.c:576
  #7  0x003c9cdd in ArenaEnter (arena=0x7100000) at global.c:553
  #8  mps_ap_fill (p_o=p_o@entry=0x1fc5f838, mps_ap=mps_ap@entry=0xa605bc4, size=size@entry=24) at mpsi.c:1094
  #9  0x002c2036 in alloc_impl (size=24, size@entry=16, type=type@entry=IGC_OBJ_STRING, ap=0xa605bc4) at igc.c:3218
  #10 0x002c48f3 in alloc (type=IGC_OBJ_STRING, size=16) at igc.c:3236
  #11 igc_make_string (nchars=nchars@entry=3, nbytes=nbytes@entry=3, unibyte=unibyte@entry=false, clear=clear@entry=false) at igc.c:3344
  #12 0x002c496d in igc_make_multibyte_string (nchars=nchars@entry=3, nbytes=nbytes@entry=3, clear=clear@entry=false) at igc.c:3354
  #13 0x00209f39 in make_clear_multibyte_string (clearit=false, nbytes=3, nchars=3) at alloc.c:2635
  #14 make_clear_string (length=length@entry=3, clearit=clearit@entry=false) at alloc.c:2612
  #15 0x00209f97 in make_clear_string (clearit=<optimized out>, length=<optimized out>) at alloc.c:2621
  #16 make_uninit_string (length=3) at alloc.c:2623
  #17 make_uninit_string (length=3) at alloc.c:2621
  #18 make_unibyte_string (contents=contents@entry=0x82f3a0 <root_dir> "d:/", length=length@entry=3) at alloc.c:2538
  #19 0x0020a058 in make_string (contents=contents@entry=0x82f3a0 <root_dir> "d:/", nbytes=3) at alloc.c:2526
  #20 0x001d9f2b in build_string (str=0x82f3a0 <root_dir> "d:/") at lisp.h:4687
  #21 Fexpand_file_name (name=0x14800eb4, default_directory=default_directory@entry=0x0) at fileio.c:1070
  #22 0x001e1316 in Fdo_auto_save (no_message=<optimized out>, no_message@entry=0x18, current_only=current_only@entry=0x0) at lisp.h:1191
  #23 0x00194ada in shut_down_emacs (sig=sig@entry=22, stuff=stuff@entry=0x0) at lisp.h:1191
  #24 0x00194d06 in terminate_due_to_signal (sig=sig@entry=22, backtrace_limit=backtrace_limit@entry=2147483647) at lisp.h:1191
  #25 0x002c2ebc in igc_assert_fail (file=0x7b8b1f <__mon_yday+27679> "ss.c", line=66, msg=0x7b8b3d <__mon_yday+27709> "warmest < stackCold") at igc.c:181
  #26 0x0039571d in mps_lib_assert_fail (condition=0x7b8b3d <__mon_yday+27709> "warmest < stackCold", line=66, file=0x7b8b1f <__mon_yday+27679> "ss.c") at mpsliban.c:87
  #27 StackScan (ss=0x1fc5fb70, stackCold=0x1edeff28, scan_area=0x2c11f9 <scan_ambig>, closure=0x0) at ss.c:66
  #28 0x003c7494 in RootScan (ss=ss@entry=0x1fc5fb70, root=root@entry=0xa60e83c) at root.c:577
  #29 0x003c7d1d in traceScanRootRes (ts=ts@entry=1, rank=rank@entry=0, arena=arena@entry=0x7100000, root=root@entry=0xa60e83c) at trace.c:528
  #30 0x003c8118 in traceScanRoot (root=0xa60e83c, arena=0x7100000, rank=0, ts=1) at trace.c:545
  #31 rootFlip (p=<synthetic pointer>, root=0xa60e83c) at trace.c:580
  #32 RootsIterate (p=<synthetic pointer>, f=<optimized out>, arena=0x7100008) at root.c:665
  #33 traceFlip (trace=0x7100498) at trace.c:652
  #34 TraceStart (trace=0x7100498, mortality=0.78544231075332438, finishingTime=189006713) at trace.c:1694
  #35 0x003c89ab in TraceStartCollectAll (traceReturn=traceReturn@entry=0x1fc5fca8, arena=arena@entry=0x7100000, why=why@entry=4) at trace.c:1794
  #36 0x003c9788 in ArenaStartCollect (globals=globals@entry=0x7100008, why=why@entry=4) at traceanc.c:634
  #37 0x003c97e4 in ArenaCollect (globals=globals@entry=0x7100008, why=why@entry=4) at traceanc.c:652
  #38 0x003c9886 in mps_arena_collect (arena=0x7100000) at mpsi.c:313
  #39 0x002c4582 in igc_collect () at igc.c:3150
  #40 0x002c4599 in Figc__collect () at igc.c:3159
  #41 0x00239c8a in eval_sub (form=0xe58609b) at eval.c:2613
  #42 0x00239fa3 in Fprogn (body=0x0) at eval.c:448

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.

And what does "warmest < stackCold" mean, in human-understandable
terms, anyway?



  reply	other threads:[~2024-06-22 19:17 UTC|newest]

Thread overview: 106+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-20 19:25 MPS: profiler Ihor Radchenko
2024-06-20 19:40 ` Eli Zaretskii
2024-06-20 19:48   ` Ihor Radchenko
2024-06-20 19:58     ` Gerd Möllmann
2024-06-20 20:29       ` Ihor Radchenko
2024-06-21  5:57         ` Gerd Möllmann
2024-06-21  6:17         ` Eli Zaretskii
2024-06-21  6:54           ` Gerd Möllmann
2024-06-21  7:16             ` Eli Zaretskii
2024-06-21  7:32               ` Gerd Möllmann
2024-06-21  7:19             ` Helmut Eller
2024-06-21  7:36               ` Ihor Radchenko
2024-06-21  7:44                 ` Helmut Eller
2024-06-21  7:51                   ` Gerd Möllmann
2024-06-21  8:21                     ` Helmut Eller
2024-06-21  8:31                       ` Gerd Möllmann
2024-06-21 10:45                         ` Eli Zaretskii
2024-06-21 11:47                           ` Gerd Möllmann
2024-06-21 12:01                             ` Helmut Eller
2024-06-21 12:09                               ` Ihor Radchenko
2024-06-21 12:42                                 ` Helmut Eller
2024-06-21 12:51                                   ` Ihor Radchenko
2024-06-21 14:49                                     ` MPS make-thread (was: MPS: profiler) Helmut Eller
2024-06-21 15:20                                       ` MPS make-thread Gerd Möllmann
2024-06-21 15:33                                         ` Gerd Möllmann
2024-06-21 15:42                                           ` Helmut Eller
2024-06-21 16:46                                             ` Gerd Möllmann
2024-06-21 18:31                                               ` Gerd Möllmann
2024-06-21 19:58                                                 ` Ihor Radchenko
2024-06-21 20:10                                                   ` Gerd Möllmann
2024-06-22 18:52                                                     ` Ihor Radchenko
2024-06-22 19:17                                                       ` Eli Zaretskii [this message]
2024-06-23  3:18                                                         ` Gerd Möllmann
2024-06-23  4:54                                                           ` Gerd Möllmann
2024-06-23  6:19                                                             ` Eli Zaretskii
2024-06-23  5:53                                                           ` Eli Zaretskii
2024-06-23  6:45                                                             ` Gerd Möllmann
2024-06-23  8:53                                                               ` Eli Zaretskii
2024-06-23  9:36                                                                 ` Gerd Möllmann
2024-06-23 10:21                                                                   ` Gerd Möllmann
2024-06-23 10:27                                                                     ` Gerd Möllmann
2024-06-23 13:19                                                                       ` Eli Zaretskii
2024-06-23 14:16                                                                         ` Gerd Möllmann
2024-06-26 11:20                                                                         ` Ihor Radchenko
2024-06-26 11:25                                                                           ` Gerd Möllmann
2024-06-22 19:26                                                       ` Gerd Möllmann
2024-06-22  6:29                                                   ` Eli Zaretskii
2024-06-22 18:53                                                     ` Ihor Radchenko
2024-06-22 19:04                                                       ` Eli Zaretskii
2024-06-22 19:17                                                         ` Ihor Radchenko
2024-06-22 18:13                                                 ` Helmut Eller
2024-06-22 18:31                                                   ` Gerd Möllmann
2024-06-25 18:42                                                   ` MPS native subrs (was: MPS make-thread) Helmut Eller via Emacs development discussions.
2024-06-25 20:10                                                     ` MPS native subrs Gerd Möllmann
2024-06-25 20:48                                                       ` Gerd Möllmann
2024-06-26  6:31                                                         ` Helmut Eller
2024-06-26  7:00                                                           ` Gerd Möllmann
2024-06-26 13:45                                                             ` Eli Zaretskii
2024-06-26 14:18                                                               ` Gerd Möllmann
2024-06-26 15:15                                                             ` Helmut Eller
2024-06-26 17:12                                                               ` Gerd Möllmann
2024-06-26 13:30                                                         ` Eli Zaretskii
2024-06-26 13:34                                                         ` Eli Zaretskii
2024-06-26  4:55                                                       ` Gerd Möllmann
2024-06-26 13:36                                                       ` Eli Zaretskii
2024-06-26 13:26                                                     ` MPS native subrs (was: MPS make-thread) Eli Zaretskii
2024-06-26 14:41                                                     ` MPS native subrs Andrea Corallo
2024-06-21 12:43                                 ` MPS: profiler Gerd Möllmann
2024-06-21 16:11                                   ` Ihor Radchenko
2024-06-21 12:41                               ` Gerd Möllmann
2024-06-21 14:10                             ` Eli Zaretskii
2024-06-21 16:09                               ` Ihor Radchenko
2024-06-21 16:22                                 ` Gerd Möllmann
2024-06-21 18:51                                 ` Ihor Radchenko
2024-06-21 18:58                                   ` Gerd Möllmann
2024-06-21 19:23                                     ` Ihor Radchenko
2024-06-21 19:50                                       ` Gerd Möllmann
2024-06-21 20:02                                         ` Ihor Radchenko
2024-06-22  6:37                                           ` Eli Zaretskii
2024-06-21  7:43               ` Gerd Möllmann
2024-06-21  7:50                 ` Ihor Radchenko
2024-06-21  7:53                   ` Gerd Möllmann
2024-06-21 10:39                   ` Eli Zaretskii
2024-06-21 10:57                     ` Ihor Radchenko
2024-06-21 10:58                       ` Eli Zaretskii
2024-06-21 11:20                         ` Ihor Radchenko
2024-06-21 11:29                           ` Eli Zaretskii
2024-06-21 11:33                         ` Gerd Möllmann
2024-06-21 19:55                           ` Dmitry Gutov
2024-06-21 16:12           ` Ihor Radchenko
2024-06-21 18:48             ` Eli Zaretskii
2024-06-21 10:49         ` Pip Cet
2024-06-21 10:56           ` Eli Zaretskii
2024-06-21  5:56     ` Eli Zaretskii
2024-06-21  6:14       ` Ihor Radchenko
2024-06-20 19:50 ` Gerd Möllmann
2024-06-20 20:02   ` Ihor Radchenko
2024-06-21  5:58     ` Eli Zaretskii
2024-06-21  6:16       ` Ihor Radchenko
2024-06-21  8:23 ` Pip Cet
2024-06-21  8:43   ` Ihor Radchenko
2024-06-21  8:50   ` Gerd Möllmann
2024-06-21 10:43   ` Eli Zaretskii
2024-06-21 11:00     ` Pip Cet
2024-06-21 11:09       ` Eli Zaretskii
2024-06-21 11:39         ` Gerd Möllmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86sex4g53k.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=eller.helmut@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=gerd.moellmann@gmail.com \
    --cc=yantar92@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.