Subject: bug#65193: 29.1.50; SET_FRAME_ICONIFIED can cause Lisp evaluation inside read_socket_hook.

From: Po Lu <[email-masked]>
Date: Thu, 10 Aug 2023 21:03:31 +0800

YAMAMOTO Mitsuharu <[email-masked]> writes:

> To my understanding, the Lisp evaluator is not reentrant, and thus
> Lisp evaluation inside read_socket_hook, which can be called from
> fairly arbitrary places via unblock_input/maybe_quit, causes
> hard-to-reproduce, spontaneous crashes.

Only if that Lisp is permitted to signal out of those arbitrary places,
since we no longer call read_socket_hook directly from signal handlers.
Mode line format evaluation catches all non-local exits, AFAIK.

> That's really surprising.  I've once heard we shouldn't do that.  Is
> that changed?

I think so, see above.

> My understanding is that GC can only be triggered by eval_sub or
> Ffuncall calls (except explicit garbage_collect calls), but not by
> Lisp object allocations, for example.  Avoiding Lisp evaluation inside
> read_socket_hook also means avoiding GC inside read_socket_hook.

Hmm.  But given that we haven't avoided Lisp evaluation within
read_socket_hook for some time now, that's still a moot point.