All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Richard Purdie <richard.purdie@linuxfoundation.org>,
	bitbake-devel@lists.openembedded.org
Subject: Re: [PATCH] process: Flush server stdout/stderr before reporting failure
Date: Tue, 4 Sep 2018 15:09:07 +0200	[thread overview]
Message-ID: <66fb849c-41d7-650a-046c-bc09e76fd594@siemens.com> (raw)
In-Reply-To: <f22cc8eccc5b47a29c87de3b6ad9193d22f486b6.camel@linuxfoundation.org>

On 2018-09-04 14:34, Richard Purdie wrote:
> On Tue, 2018-09-04 at 13:15 +0100, Richard Purdie wrote:
>> On Sun, 2018-09-02 at 10:43 +0200, Jan Kiszka wrote:
>>> We need to print exceptions and flush output channels before
>>> telling
>>> the
>>> client that the server failed. Otherwise the daemon log file may
>>> still
>>> be empty when the client opens it for printing.
>>>
>>> This fixes error reporting when the output is redirected to a pipe,
>>> e.g.
>>> "bitbake target | cat" with a syntax error in a recipes or config
>>> file.
>>> That's specifically annoying when bitbake is under the control of a
>>> frontend process such as kas.
>>
>> Hi,
>>
>> Could you check if this was already fixed by:
>>
>> http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=cbe2d3cb0af6c7a5
>> cd368e7dc489960a13648bd0

Looks similar on first glance, but it only partly helps with exceptions. 
We get from

$ bitbake | cat
ERROR: Unable to start bitbake server

to

$ bitbake | cat
ERROR: Unable to start bitbake server
ERROR: Server log for this session (/work/build/bitbake-cookerdaemon.log):
--- Starting bitbake server pid 149 at 2018-09-04 13:02:15.144583 ---

while it should have

$ bitbake
ERROR: Unable to start bitbake server
ERROR: Last 10 lines of server log for this session 
(/work/build/bitbake-cookerdaemon.log):
Traceback (most recent call last):
   File "/work/isar/bitbake/lib/bb/daemonize.py", line 77, in createDaemon
     function()
   File "/work/isar/bitbake/lib/bb/server/process.py", line 433, in 
_startServer
     self.cooker = bb.cooker.BBCooker(self.configuration, self.featureset)
   File "/work/isar/bitbake/lib/bb/cooker.py", line 178, in __init__
     self.configwatcher = pyinotify.WatchManager()
   File "/work/isar/bitbake/lib/pyinotify.py", line 1764, in __init__
     raise OSError(err % self._inotify_wrapper.str_errno())
OSError: Cannot initialize new instance of inotify, Errno=Too many open 
files (EMFILE)

>>
>> ?
>>
>> I really want to get these flushes as close to the source of the
>> problems as we can.
> 
> Looking at the code further, I suspect we should simply be doing:
> 
>          writer = ConnectionWriter(self.readypipein)
>          self.cooker = bb.cooker.BBCooker(self.configuration, self.featureset)
>          writer.send("ready")
>          os.close(self.readypipein)
>          server.cooker = self.cooker
> 
> with no exception handling. The ready pipe would then get closed by the
> os._exit() in daemonize which is after the flush. It simplifies the
> code as an added bonus...

Tried that, but it does not work that way, it just hangs.

As I wrote, the test case is trivial: just direct the output of bitbake 
into a pipe (bitbake | cat).

Jan


  reply	other threads:[~2018-09-04 13:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-02  8:43 [PATCH] process: Flush server stdout/stderr before reporting failure Jan Kiszka
2018-09-04 12:15 ` Richard Purdie
2018-09-04 12:34   ` Richard Purdie
2018-09-04 13:09     ` Jan Kiszka [this message]
2018-09-05  0:14       ` richard.purdie
2018-09-07  9:48         ` Jan Kiszka

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=66fb849c-41d7-650a-046c-bc09e76fd594@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=richard.purdie@linuxfoundation.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.