MPTCP Linux Development
 help / color / mirror / Atom feed
From: Matthieu Baerts <matttbe@kernel.org>
To: Geliang Tang <geliang@kernel.org>, mptcp@lists.linux.dev
Cc: Geliang Tang <tanggeliang@kylinos.cn>
Subject: Re: [PATCH mptcp-next] selftests: mptcp: diag: use mptcp_lib_get_info_value
Date: Thu, 10 Apr 2025 19:04:13 +0200	[thread overview]
Message-ID: <2eb6a3eb-3417-4ecf-861d-72939fe15562@kernel.org> (raw)
In-Reply-To: <f38c01ca-9b68-4746-b0d4-2375ecc09f87@kernel.org>

On 10/04/2025 18:58, Matthieu Baerts wrote:
> Hi Geliang,
> 
> On 03/04/2025 09:46, Geliang Tang wrote:
>> From: Geliang Tang <tanggeliang@kylinos.cn>
>>
>> When running diag.sh in a loop, chk_dump_one will report the following
>> "grep: write error":
>>
>>  13 ....chk 2 cestab                                  [ OK ]
>>  grep: write error
>>  14 ....chk dump_one                                  [ OK ]
>>  15 ....chk 2->0 msk in use after flush               [ OK ]
>>  16 ....chk 2->0 cestab after flush                   [ OK ]
>>
>> This error is caused by a broken pipe. When the output of 'ss' is processed
>> by grep, 'head -n 1' will exit immediately after getting the first line,
>> causing the subsequent pipe to close. At this time, if 'grep' is still
>> trying to write data to the closed pipe, it will trigger a SIGPIPE signal,
>> causing a write error.
>>
>> One solution is not to use this problematic "head -n 1" command, but to use
>> mptcp_lib_get_info_value() helper defined in mptcp_lib.sh to get the value
>> of 'token'.
> 
> I was wondering why this helper would help because there will be 2
> connections, and it is still required to limit the output to one. Then I
> saw this helper does limit to the first entry because of 'sed (...);q'.
> 
> I will modify the message here to explain that. And maybe add a comment
> in mptcp_lib.sh as well for later.

Note: technically, we can still have the issue with
mptcp_lib_get_info_value because we also have 'grep | sed' where 'sed'
can finish while 'grep' is still writing. I guess you no longer see the
warning because 'sed' will be slower than 'head -n1'. But OK, this can
be improved later.

> Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
> 
> Cheers,
> Matt

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.


  reply	other threads:[~2025-04-10 17:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-03  7:46 [PATCH mptcp-next] selftests: mptcp: diag: use mptcp_lib_get_info_value Geliang Tang
2025-04-04  1:47 ` Gang Yan
2025-04-10 16:58 ` Matthieu Baerts
2025-04-10 17:04   ` Matthieu Baerts [this message]
2025-04-10 17:21 ` Matthieu Baerts

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=2eb6a3eb-3417-4ecf-861d-72939fe15562@kernel.org \
    --to=matttbe@kernel.org \
    --cc=geliang@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=tanggeliang@kylinos.cn \
    /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