* Re: emacs-27 41232e6: Avoid crashes due to bidi cache being reset during redisplay
[not found] ` <20200531142647.08FCA20A2B@vcs0.savannah.gnu.org>
@ 2020-05-31 14:44 ` Pip Cet
2020-05-31 15:12 ` Eli Zaretskii
0 siblings, 1 reply; 7+ messages in thread
From: Pip Cet @ 2020-05-31 14:44 UTC (permalink / raw
To: emacs-devel, Eli Zaretskii; +Cc: emacs-diffs
On Sun, May 31, 2020 at 2:26 PM Eli Zaretskii <eliz@gnu.org> wrote:
> diff --git a/src/xdisp.c b/src/xdisp.c
> index bff6218..60848f4 100644
> --- a/src/xdisp.c
> +++ b/src/xdisp.c
> @@ -11539,7 +11539,9 @@ display_echo_area_1 (ptrdiff_t a1, Lisp_Object a2)
> /* Display. */
> clear_glyph_matrix (w->desired_matrix);
> XSETWINDOW (window, w);
> + void *itdata = bidi_shelve_cache ();
But what if we're out of memory? bidi_shelve_cache will call xmalloc...
(Playing around with this, the composition code also tries to allocate
memory when I call memory_full.)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: emacs-27 41232e6: Avoid crashes due to bidi cache being reset during redisplay
2020-05-31 14:44 ` emacs-27 41232e6: Avoid crashes due to bidi cache being reset during redisplay Pip Cet
@ 2020-05-31 15:12 ` Eli Zaretskii
2020-05-31 15:36 ` Pip Cet
0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2020-05-31 15:12 UTC (permalink / raw
To: Pip Cet; +Cc: emacs-diffs, emacs-devel
> From: Pip Cet <pipcet@gmail.com>
> Date: Sun, 31 May 2020 14:44:54 +0000
> Cc: emacs-diffs@gnu.org
>
> > + void *itdata = bidi_shelve_cache ();
>
> But what if we're out of memory? bidi_shelve_cache will call xmalloc...
xmalloc calls memory_full if that happens.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: emacs-27 41232e6: Avoid crashes due to bidi cache being reset during redisplay
2020-05-31 15:12 ` Eli Zaretskii
@ 2020-05-31 15:36 ` Pip Cet
2020-05-31 15:46 ` Eli Zaretskii
0 siblings, 1 reply; 7+ messages in thread
From: Pip Cet @ 2020-05-31 15:36 UTC (permalink / raw
To: Eli Zaretskii; +Cc: emacs-diffs, emacs-devel
On Sun, May 31, 2020 at 3:12 PM Eli Zaretskii <eliz@gnu.org> wrote:
> > From: Pip Cet <pipcet@gmail.com>
> > Date: Sun, 31 May 2020 14:44:54 +0000
> > Cc: emacs-diffs@gnu.org
> >
> > > + void *itdata = bidi_shelve_cache ();
> >
> > But what if we're out of memory? bidi_shelve_cache will call xmalloc...
>
> xmalloc calls memory_full if that happens.
Sorry, should have been more explicit: if we run out of memory,
memory_full will signal an error, after freeing some "spare" memory.
The error handler will call echo_display_area_1. If the bidi iterator
is in use, the cache size is much larger than the spare memory we
freed, so the allocation will also fail, and I'm not sure we ever
recover from that.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: emacs-27 41232e6: Avoid crashes due to bidi cache being reset during redisplay
2020-05-31 15:36 ` Pip Cet
@ 2020-05-31 15:46 ` Eli Zaretskii
2020-05-31 16:07 ` Eli Zaretskii
2020-05-31 16:24 ` Pip Cet
0 siblings, 2 replies; 7+ messages in thread
From: Eli Zaretskii @ 2020-05-31 15:46 UTC (permalink / raw
To: Pip Cet; +Cc: emacs-diffs, emacs-devel
> From: Pip Cet <pipcet@gmail.com>
> Date: Sun, 31 May 2020 15:36:22 +0000
> Cc: emacs-devel@gnu.org, emacs-diffs@gnu.org
>
> > xmalloc calls memory_full if that happens.
>
> Sorry, should have been more explicit: if we run out of memory,
> memory_full will signal an error, after freeing some "spare" memory.
> The error handler will call echo_display_area_1. If the bidi iterator
> is in use, the cache size is much larger than the spare memory we
> freed, so the allocation will also fail, and I'm not sure we ever
> recover from that.
Yes, our code is full of such places. It would be good to improve the
recovery in these cases.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: emacs-27 41232e6: Avoid crashes due to bidi cache being reset during redisplay
2020-05-31 15:46 ` Eli Zaretskii
@ 2020-05-31 16:07 ` Eli Zaretskii
2020-05-31 16:24 ` Pip Cet
1 sibling, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2020-05-31 16:07 UTC (permalink / raw
To: pipcet; +Cc: emacs-devel
Btw, please don't CC emacs-diffs, that list should be free of any
messages that aren't repository diffs.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: emacs-27 41232e6: Avoid crashes due to bidi cache being reset during redisplay
2020-05-31 15:46 ` Eli Zaretskii
2020-05-31 16:07 ` Eli Zaretskii
@ 2020-05-31 16:24 ` Pip Cet
2020-05-31 16:33 ` Eli Zaretskii
1 sibling, 1 reply; 7+ messages in thread
From: Pip Cet @ 2020-05-31 16:24 UTC (permalink / raw
To: Eli Zaretskii; +Cc: emacs-devel
On Sun, May 31, 2020 at 3:46 PM Eli Zaretskii <eliz@gnu.org> wrote:
> > From: Pip Cet <pipcet@gmail.com>
> > Date: Sun, 31 May 2020 15:36:22 +0000
> > Sorry, should have been more explicit: if we run out of memory,
> > memory_full will signal an error, after freeing some "spare" memory.
> > The error handler will call echo_display_area_1. If the bidi iterator
> > is in use, the cache size is much larger than the spare memory we
> > freed, so the allocation will also fail, and I'm not sure we ever
> > recover from that.
> Yes, our code is full of such places. It would be good to improve the
> recovery in these cases.
I've played around a little, and when resize-mini-windows is nil, it's
quite easy to get into a loop where the OOM message isn't displayed.
Without the patch, recovery sometimes works. Maybe it's just time to
update SPARE_SIZE to reflect the amount of memory the bidi iterator
currently needs.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: emacs-27 41232e6: Avoid crashes due to bidi cache being reset during redisplay
2020-05-31 16:24 ` Pip Cet
@ 2020-05-31 16:33 ` Eli Zaretskii
0 siblings, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2020-05-31 16:33 UTC (permalink / raw
To: Pip Cet; +Cc: emacs-devel
> From: Pip Cet <pipcet@gmail.com>
> Date: Sun, 31 May 2020 16:24:23 +0000
> Cc: emacs-devel@gnu.org
>
> I've played around a little, and when resize-mini-windows is nil, it's
> quite easy to get into a loop where the OOM message isn't displayed.
> Without the patch, recovery sometimes works. Maybe it's just time to
> update SPARE_SIZE to reflect the amount of memory the bidi iterator
> currently needs.
Feel free to suggest a patch for the master branch along those lines.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-05-31 16:33 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20200531142645.22884.78754@vcs0.savannah.gnu.org>
[not found] ` <20200531142647.08FCA20A2B@vcs0.savannah.gnu.org>
2020-05-31 14:44 ` emacs-27 41232e6: Avoid crashes due to bidi cache being reset during redisplay Pip Cet
2020-05-31 15:12 ` Eli Zaretskii
2020-05-31 15:36 ` Pip Cet
2020-05-31 15:46 ` Eli Zaretskii
2020-05-31 16:07 ` Eli Zaretskii
2020-05-31 16:24 ` Pip Cet
2020-05-31 16:33 ` Eli Zaretskii
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.