Some additional information... The fork(2) man page says: "The child process is created with a single thread—the one that called fork()." This means that the font-map thread created by Pango remains a thread of the parent process, and there is no duplicate thread for the child process. Said otherwise, the child process will communicate with the font-map thread (via a queue) of the parent process, which is probably fine... until this thread is terminated by the exit() of the parent process. Calling...
The advice to release the font map before the fork was from Matthias Clasen (see the Pango bug). In any case, I think that this release should be done at least for the child process. Otherwise, the child process would need the thread attached to the parent process (for the current font map), but this thread is killed when the parent process exits.
To fix the bug in Gnuplot, pango_cairo_font_map_set_default(NULL); needs to be called before the fork(), as advised in the Pango issue. See my patch for the gnuplot Debian package.
If this is an API breakage from Pango, this is also an ABI breakage (as the behavior is modified in an incompatible way). I recall the bug I opened on the Pango side: https://gitlab.gnome.org/GNOME/pango/-/issues/784
I think I have found the cause of the issue: gnuplot does an exit_group(0), which causes a Pango thread to terminate unexpectedly. Now, I don't know whether the is a bug in gnuplot, a bug in the Pango library, or an API breakage.
I did not see this message, grrr... Here's the stack trace: #0 syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38 #1 0x00007f60d833ea84 in g_cond_wait_impl (cond=0x55a694e3ab80, mutex=0x55a694e3ab78) at ../../../glib/gthread-posix.c:1007 #2 g_cond_wait (cond=cond@entry=0x55a694e3ab80, mutex=mutex@entry=0x55a694e3ab78) at ../../../glib/gthread.c:1665 #3 0x00007f60d77a42e3 in pango_fc_patterns_get_font_pattern (pats=0x55a694e3ab70, i=0, prepare=<synthetic pointer>) at ../pango/pangofc-fontmap.c:1136...
maxima.el triggers a warning about deprecated positional arguments to define-minor-mode
So, a simple command to reproduce the issue: echo 'set terminal wxt; plot x' | gnuplot -persist