[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nano-devel] [PATCH] just use a wait() instead

From: Marco Diego Aurélio Mesquita
Subject: Re: [Nano-devel] [PATCH] just use a wait() instead
Date: Sun, 19 Aug 2018 12:28:14 -0300
User-agent: NeoMutt/20170113 (1.7.2)

On Sun, Aug 19, 2018 at 10:07:03AM +0200, Benno Schulenberg wrote:
> Op 19-08-18 om 01:17 schreef Marco Diego Aurélio Mesquita:
> > On Fri, Aug 17, 2018 at 08:27:36PM +0200, Benno Schulenberg wrote:
> >> But it is puzzling.  I'd like to know what the filtering fork()
> >> is doing wrong.
> > 
> > I still don't know what causes it. Anyway, attached patch fixes it with
> > addition of only 3 lines.
> Attached patch also seems to fix it, and is much smaller.
> (The error message is crap, of course, but the two lines were simply
> copied from forty lines further down.)
> The problem appears to be that send_data() process wasn't releasing
> its resources/descriptors.  The wait() takes care of that.
> Does this patch solve the problem for you too?

This patch makes the problem not occur on my machine but this is not a
solution. With the added wait call, nano main process will wait before
finally starting updating the text. The whole idea of having 3 process
(besides performance on multicore machines) is that 3 things can be
done concurrently: outputting the data, filtering it and updating the
buffer, if one of these process has to wait for another to complete,
then there's no reason in using 3 processes. Without 3 processes we can
get stuck because IO buffers may get full. It is a rare but possible
condition. If you don't care about this possibility, you can use the
solution I proposed on Savannah, it will have to output the data before
updating the text and it removes lines.

Now, it is possible to use your idea to get a correct fix: just wait for
the children to die after the whole task is finished. The attached patch
does this. And now we have 5 solutions for this problem. I still prefer
the reshuffling one because it condenses important code toghether. So
we can later extract it to another function and use it on the spell
feature. The spell feature uses a temp file for now, but we could make
it work just like the filtering feature.

Attachment: 0001-filtering-wait-for-the-sending-process-to-terminate.patch
Description: Text Data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]