From: Dominique Martinet <asmadeus@codewreck.org>
To: Tom Herbert <tom@quantonium.net>
Cc: Linux Kernel Network Developers <netdev@vger.kernel.org>
Subject: Re: KCM - recvmsg() mangles packets?
Date: Sat, 4 Aug 2018 04:08:06 +0200 [thread overview]
Message-ID: <20180804020806.GA32338@nautica> (raw)
In-Reply-To: <20180804014132.GA26606@nautica>
Dominique Martinet wrote on Sat, Aug 04, 2018:
> Actually, now I'm looking closer to the timing, it looks specific to the
> connection setup. This send loop works:
> int i = 1;
> while(i <= 1000) {
> int len = (i++ * 1312739ULL) % 31 + 1;
> my_msg.hdr.len = htonl(len);
> for (int j = 0; j < len; ) {
> j += snprintf(my_msg.data + j, len - j,
> "%i", i - 1);
> }
> my_msg.data[len-1] = '\0';
> //printf("%d: writing %d\n", i-1, len);
> len = write(s, &my_msg, sizeof(my_msg.hdr) + len);
> if (error == -1)
> err(EXIT_FAILURE, "write");
> if (i == 2)
> usleep(1);
> }
>
> But removing the usleep(1) after the first packet makes recvmsg()
> "fail": it reads the content of the second packet with the size of the
> first.
I talked too fast, I can get this to fail on later packets e.g.
Got 18, expected 31 on 452nd message: 453453453453453453; flags: 80
The content is 453 in a loop so this really is the 453rd packet...
But being slower e.g. doing that usleep after every single packets and I
could let the loop run until 100k without a hintch.
There really has to be something wrong, I just can't tell what from
looking at the code with my naive eyes.
Maybe we need to lock both the tcp and the kcm sockets?
Thanks,
--
Dominique
next prev parent reply other threads:[~2018-08-04 4:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-03 18:28 KCM - recvmsg() mangles packets? Dominique Martinet
2018-08-03 22:46 ` Tom Herbert
2018-08-03 23:20 ` Dominique Martinet
2018-08-04 1:18 ` Tom Herbert
2018-08-04 1:41 ` Dominique Martinet
2018-08-04 2:08 ` Dominique Martinet [this message]
2018-08-05 6:44 ` Dominique Martinet
2018-08-05 14:12 ` Dominique Martinet
2018-08-05 23:39 ` Dominique Martinet
2018-08-09 20:58 ` Tom Herbert
2018-08-09 22:06 ` Dominique Martinet
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=20180804020806.GA32338@nautica \
--to=asmadeus@codewreck.org \
--cc=netdev@vger.kernel.org \
--cc=tom@quantonium.net \
/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