Openembedded Bitbake Development
 help / color / mirror / Atom feed
From: Kang Kai <Kai.Kang@windriver.com>
To: Chris Larson <clarson@kergoth.com>
Cc: bitbake-devel@lists.openembedded.org, Zhenfeng.Zhao@windriver.com
Subject: Re: [PATCH 1/1] cooker.py: terminate the Parser processes
Date: Thu, 24 May 2012 16:29:25 +0800	[thread overview]
Message-ID: <4FBDF165.5060201@windriver.com> (raw)
In-Reply-To: <CABcZAN=Rs1HC6dTKOvU4r2cuO04m10f1-hoNtRfox_xgVhbsxg@mail.gmail.com>

On 2012年05月23日 23:34, Chris Larson wrote:
> terminate()'ing processes can corrupt any queues those processes have
> open, and thereby disrupt any pending log messages in the queues
> heading to the ui as a result. If that's not an issue here, so be it,
> but be aware of the issues -- we had to remove terminate() from the
> shutdown in the past due to this issue.
Hi Chris,

Call terminate() directly seems not be elegant. But I didn't figure out 
why after the queue belongs to Parse process
calls  cancel_join_thread(), so ..
Before the terminate() the every Parse process, it is waited for 0.1 
second to quit.
If the process will not be blocked, I suppose that 0.1 second is enough 
for them to quit.

What's your opinion?

Thanks,
Kai
>
> On Wed, May 23, 2012 at 2:40 AM, Kang Kai<kai.kang@windriver.com>  wrote:
>> [Yocto 2142]
>>
>> Force to exit HOB when hob is parsing recipes, the bitbake doesn't stop.
>> It hangs on function BitBakeServerConnection::terminate in file
>> server/process.py:
>>     else:
>>         self.procserver.join()
>> It is waiting for the children process quit.
>>
>> In stage of parse recipes BBCooker spawns Parser processes as many as
>> cpu numbers. When quit the Parser processes they make their internal
>> Queue to call cancel_join_thread() to avoid block but don't work at
>> this time.
>> So force to terminate the Parser processes.
>>
>> Signed-off-by: Kang Kai<kai.kang@windriver.com>
>> ---
>>   bitbake/lib/bb/cooker.py |    9 ++++++---
>>   1 files changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
>> index dea0aad..4a4dc38 100644
>> --- a/bitbake/lib/bb/cooker.py
>> +++ b/bitbake/lib/bb/cooker.py
>> @@ -1175,7 +1175,7 @@ class BBCooker:
>>              return
>>
>>          if self.state in (state.shutdown, state.stop):
>> -            self.parser.shutdown(clean=False)
>> +            self.parser.shutdown(clean=False, force = True)
>>              sys.exit(1)
>>
>>          if self.state != state.parsing:
>> @@ -1608,10 +1608,13 @@ class CookerParser(object):
>>                  self.parser_quit.put(None)
>>
>>              self.jobs.cancel_join_thread()
>> -            sys.exit(1)
>>
>>          for process in self.processes:
>> -            process.join()
>> +            if force:
>> +                process.join(.1)
>> +                process.terminate()
>> +            else:
>> +                process.join()
>>          self.feeder.join()
>>
>>          sync = threading.Thread(target=self.bb_cache.sync)
>> --
>> 1.7.5.4
>>
>>
>> _______________________________________________
>> bitbake-devel mailing list
>> bitbake-devel@lists.openembedded.org
>> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/bitbake-devel
>
>




      reply	other threads:[~2012-05-24  8:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-23  9:40 [PATCH 0/1] Force to teminate the Parser process Kang Kai
2012-05-23  9:40 ` [PATCH 1/1] cooker.py: terminate the Parser processes Kang Kai
2012-05-23 15:34   ` Chris Larson
2012-05-24  8:29     ` Kang Kai [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FBDF165.5060201@windriver.com \
    --to=kai.kang@windriver.com \
    --cc=Zhenfeng.Zhao@windriver.com \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=clarson@kergoth.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox