On Mon, May 06, 2024 at 07:40:56PM +0800, Qian Yun wrote:
> I have not met the races in graphics, but Ralf, Waldek and
> I have all met the races in sman:
>
> Namely, when building the book, sometimes there's a few lines
> missing at the beginning or at the end of the tex file.
> The tex file comes from spool file, which is the piped output
> of "fricas" script.
>
> This is quiet easily to reproduce if you build the book with
> more jobs in parallel than the number of your threads of CPU.
>
> First, the missing lines at the end.
>
> sman kills all of its child processes if the FRICASsys quits.
>
> For FRICASsys, its output goes to a pty, captured by "sman"
> and forwards to "session" via socket, then "session" forward
> to "spadclient" via socket, finally "spadclient" prints to
> stdio.
>
> So when FRICASsys outputs everything and quits, sometimes
> sman kill everything while there's still a few final lines
> in socket buffer, not printed out yet.
>
> I solve this by adding sleep 100ms before "kill_all_children".
>
>
> Second, for the missing liens at the beginning.
>
> At startup, "spadclient" connects to "session", then "session"
> connects to "FRICASsys" and get a prompt ("(1) -> ") back.
>
> So after "connect_to_local_server", there's quite a few things
> going on in the background. So it is necessary to sleep a while
> before forwarding stdio (in this case, ")read xxx" from pipe)
> to "FRICASsys". Otherwise sometimes the output order is messed up.
>
>
> Ralf, please test if this fixes the build problem on your side.
Looks OK. Just one remark: this is workaround, not a fix. Proper
fix would involve change to protocol, in particular all I/O would
need an acknowlegment and 'FRICASsys' would exit only after
receiving acknowlegment about its output. Of course proper fix
needs much more work than your patch, and we can live with
workaround possibly for long time.
--
Waldek Hebisch
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/fricas-devel/ZjkAD1teYFtG7nrc%40fricas.org.