All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mikko Rapeli <mikko.rapeli@linaro.org>
To: Alexander Kanavin <alex.kanavin@gmail.com>
Cc: Richard Purdie <richard.purdie@linuxfoundation.org>,
	openembedded-core@lists.openembedded.org
Subject: Re: [OE-core] [PATCH v2 2/8] oeqa ssh.py: fix hangs in run()
Date: Thu, 9 Feb 2023 14:23:12 +0200	[thread overview]
Message-ID: <Y+TlsC4RYFmucKf8@nuoska> (raw)
In-Reply-To: <CANNYZj8KYxL_W+oPXT4T+MU3RtB6h4t7egdassM1W__9yoATxA@mail.gmail.com>

Hi,

On Thu, Feb 09, 2023 at 12:42:09PM +0100, Alexander Kanavin wrote:
> On Thu, 9 Feb 2023 at 12:12, Mikko Rapeli <mikko.rapeli@linaro.org> wrote:
> > select() returns with any data, even single character. Fancy readers
> > will read larger chunks but will read more data than is available and thus
> > block for ever. Plain read() will read the data which is available from
> > select() and thus really small amounts like single characters if that's
> > available over the socket. This is visible in the partial read output of
> > do_testimage() task output log which becomes quite unreadable without change.
> 
> Yes, but this does not explain why single characters happen to begin
> with - RP offered a hypothesis, but the problem is that data arrives
> that way, not the tight-loop manner in which we're reading it.

Without the sleep(0.2) with ssh, the do_testimage task output can be like this (which
isn't too bad, just annoying):

DEBUG: [Running]$ ssh -l root -o ServerAliveCountMax=2 -o ServerAliveInterval=30 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=ERROR -p 2222 127.0.0.1 export PATH=/usr/sbin:/sbin:/usr/bin:/bin; cat /etc/controllerimage
DEBUG: Waiting for process output: time: 1675942983.6053402, endtime: 1675943283.6033137
DEBUG: Partial data from SSH call:
cat: 
DEBUG: Waiting for process output: time: 1675942986.2085373, endtime: 1675943286.208536
DEBUG: Partial data from SSH call:
/etc/controllerimage
DEBUG: Waiting for process output: time: 1675942986.2111514, endtime: 1675943286.2111504
DEBUG: Partial data from SSH call:
: No such file or directory
DEBUG: Waiting for process output: time: 1675942986.2140906, endtime: 1675943286.2140894
DEBUG: Partial data from SSH call:


DEBUG: Waiting for process output: time: 1675942986.216261, endtime: 1675943286.21626
DEBUG: [Command returned '1' after 2.64 seconds]

I think qemu is just slower than what anyone expects, including the ssh
protocol which does some buffer but then gives up. It may also be the
kernel and image running under qemu which busy starting up, e.g.
generating entropy or keys.

With the sleep(0.2) output is:

DEBUG: [Running]$ ssh -l root -o ServerAliveCountMax=2 -o ServerAliveInterval=30 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=ERROR -p 2222 127.0.0.1 export PATH=/usr/sbin:/sbin:/usr/bin:/bin; cat /etc/controllerimage
DEBUG: Waiting for process output: time: 1675945065.6815689, endtime: 1675945365.6790204
DEBUG: Partial data from SSH call:
cat: /etc/controllerimage: No such file or directory

DEBUG: Waiting for process output: time: 1675945068.308055, endtime: 1675945368.3080513
DEBUG: [Command returned '1' after 2.83 seconds]
DEBUG: Command: cat /etc/controllerimage
Status: 1 Output:
cat: /etc/controllerimage: No such file or directory

NOTE:  ... ok

Similar thing happens then over serial console which is even slower. I
know debugging the data read and written to serial are not wanted but I
had the changes in place and saw bootloader and kernel messages being
read initally one character at a time and later on 5-10 characters at a time
which made debugging problems really annoying. The small sleep does
improve things, doesn't solve everything but also doesn't really harm.

No data is lost and less time is used looping around the file
descriptor.

Cheers,

-Mikko


  reply	other threads:[~2023-02-09 12:23 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-09  8:09 [PATCH v2 0/8] fix oeqa runtime test framework when qemu hangs Mikko Rapeli
2023-02-09  8:09 ` [PATCH v2 1/8] oeqa ssh.py: move output prints to new line Mikko Rapeli
2023-02-09  8:09 ` [PATCH v2 2/8] oeqa ssh.py: fix hangs in run() Mikko Rapeli
2023-02-09  9:15   ` [OE-core] " Richard Purdie
2023-02-09  9:36     ` Mikko Rapeli
2023-02-09 10:53       ` Alexander Kanavin
2023-02-09 10:56         ` Richard Purdie
2023-02-09 11:12         ` Mikko Rapeli
2023-02-09 11:42           ` Alexander Kanavin
2023-02-09 12:23             ` Mikko Rapeli [this message]
2023-02-09 10:20   ` Richard Purdie
2023-02-09 10:35     ` Mikko Rapeli
2023-02-09 10:52       ` Richard Purdie
2023-02-09  8:09 ` [PATCH v2 3/8] oeqa ssh.py: add connection keep alive options to ssh client Mikko Rapeli
2023-02-09  8:09 ` [PATCH v2 4/8] oeqa dump.py: add error counter and stop after 5 failures Mikko Rapeli
2023-02-09  8:09 ` [PATCH v2 5/8] oeqa qemurunner: read more data at a time from serial Mikko Rapeli
2023-02-09  8:09 ` [PATCH v2 6/8] oeqa qemurunner.py: add timeout to QMP calls Mikko Rapeli
2023-02-09  8:09 ` [PATCH v2 7/8] oeqa qemurunner.py: kill qemu if it hangs Mikko Rapeli
2023-02-09  9:45   ` [OE-core] " Alexander Kanavin
2023-02-09  9:56     ` Mikko Rapeli
2023-02-09 10:01       ` Alexander Kanavin
2023-02-09  8:09 ` [PATCH v2 8/8] oeqa qemurunner.py: try to avoid reading one character at a time Mikko Rapeli

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=Y+TlsC4RYFmucKf8@nuoska \
    --to=mikko.rapeli@linaro.org \
    --cc=alex.kanavin@gmail.com \
    --cc=openembedded-core@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.