All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
To: linux-sctp@vger.kernel.org
Subject: Re: SCTP getting EAGAIN but poll or select return socket is writable
Date: Tue, 11 Apr 2017 21:51:06 +0000	[thread overview]
Message-ID: <20170411215106.GH911@localhost.localdomain> (raw)
In-Reply-To: <45198365-50CE-456C-8F4A-8BDA672B97F7@lurchi.franken.de>

On Wed, Apr 12, 2017 at 01:54:41AM +0530, Deepak Khandelwal wrote:
> Hi,
> 

Please don't top post..

> 
> App act as client (1-1 Style SOCK_STREAM)
> App try to send 278 bytes of message.

Okay.

> 
> So you mean that, if socket has space for few bytes (say 1 or 2
> bytes), lksctp will set POLLOUT event for fd,
> but since user application doesn;t know the underlying socket space
> available, it can write more than that but will fail with EAGAIN ?

Was reading the code again on this, I actually don't think this can
happen. The sleep on waiting for sndbuf doesn't check for msgsize, just
if there is any amount of buffer available or not.

sctp_sendmsg()
{
...
        timeo = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT);
        if (!sctp_wspace(asoc)) {
                err = sctp_wait_for_sndbuf(asoc, &timeo, msg_len);
                if (err)
                        goto out_free;
        }
...
}

For returning -EAGAIN due to sndbuf, it has to match !sctp_wspace, which
is only about the soc/asoc and not the message. The EAGAIN in this case
comes from inside sctp_wait_for_sndbuf().

That leads us to my other question, are you binding/connecting this
socket before sending the message?

> 
> 
> Best Regards,
> Deepak
> 
> On Wed, Apr 12, 2017 at 12:44 AM, Michael Tuexen
> <Michael.Tuexen@lurchi.franken.de> wrote:
> >> On 11. Apr 2017, at 21:08, Deepak Khandelwal <dazz.87@gmail.com> wrote:
> >>
> >> Hi,
> >>
> >> I am using 4.4.x kernel.
> >>
> >> in context of LKSCTP, what could be the possible reasons that poll or
> >> select on fd return false positive events, causing application do
> >> write on fd but failed with EAGAIN ?
> > I'm just guessing here... What if you can write something, but not
> > something big as you try...
> > So how big is the message you are trying so send?
> >
> > Best regards
> > Michael
> >>
> >>
> >> Best Regards,
> >> Deepak
> >> --
> >> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> >> the body of a message to majordomo@vger.kernel.org
> >> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

  parent reply	other threads:[~2017-04-11 21:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-11 19:14 SCTP getting EAGAIN but poll or select return socket is writable Michael Tuexen
2017-04-11 19:20 ` Deepak Khandelwal
2017-04-11 19:36 ` Marcelo Ricardo Leitner
2017-04-11 20:36 ` Deepak Khandelwal
2017-04-11 21:51 ` Marcelo Ricardo Leitner [this message]
2017-04-12  2:50 ` Deepak Khandelwal
2017-04-12 11:56 ` Neil Horman

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=20170411215106.GH911@localhost.localdomain \
    --to=marcelo.leitner@gmail.com \
    --cc=linux-sctp@vger.kernel.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.