buglwIP - A Lightweight TCP/IP stack - Bugs: bug #49848, Non-blocking socket emit a sock...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #49848: Non-blocking socket emit a sock error while read return EWOULDBLOCK

Submitted by:  Wen Xichang <wenxichang>
Submitted on:  Thu 15 Dec 2016 10:00:27 AM UTC  
 
Category: sockets/netconnSeverity: 3 - Normal
Item Group: Faulty BehaviourStatus: Fixed
Privacy: PublicAssigned to: Simon Goldschmidt <goldsimon>
Open/Closed: ClosedPlanned Release: None
lwIP version: 2.0.0

(Jump to the original submission Jump to the original submission)

Thu 15 Dec 2016 09:34:37 PM UTC, comment #6:

I've fixed this special issue for Wen to work with 2.0.1 and added task #14275 as a reminder for cleanup in this area (which is highly related to task #13922: Remove fatal error handling).

Thanks for reporting

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Thu 15 Dec 2016 08:16:10 PM UTC, comment #5:

Thanks David, this is exactly the input I have been waiting for to continue on task #13922!

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Thu 15 Dec 2016 03:43:30 PM UTC, comment #4:

FWIW: SO_ERROR returns a "pending error" which is a precisely defined term; see sections 2.10.10, 2.10.15, and 2.10.16 of http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html . In effect, SO_ERROR should only ever return an error that has not been reported as part of a socket call. As such it can never legitimately return EWOULDBLOCK.

David van Moolenbroek <dcvmoole>
Thu 15 Dec 2016 03:27:45 PM UTC, comment #3:

Alright. Can you point me to some spec or documentation indicating this change is correct? Beacause reading opengroup.org, I saw nothing about which errors should be in the socket and which global.

So from the standards point of view, we should already be good and I don't want to get worse for other people (especially given the fact that you say you only tested linux 2.6, which is rather old).

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Thu 15 Dec 2016 03:16:01 PM UTC, comment #2:

that's exactly what i mean.
reading nonblocking socket while EWOULDBLOCK occurred shouldn't cause getsockopt(SO_ERROR) to return any error.
found this while porting nginx to lwip

Wen Xichang <wenxichang>
Thu 15 Dec 2016 11:47:44 AM UTC, comment #1:

So what exactly do you suggest? I can't tell from your post.

Is it you want 'errno' to be set but not the error returned by getsockopt(SO_ERROR) or is it something else?

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Thu 15 Dec 2016 10:00:27 AM UTC, original submission:

if (netconn_is_nonblocking(sock->conn) && (sock->rcvevent <= 0)) {
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d): returning EWOULDBLOCK\n", s));
sock_set_errno(sock, EWOULDBLOCK); <-------- shoud set errno only
return -1;
}

same in lwip_recvfrom function.

the behavior is diff from linux(2.6+)
(don't have other unix)

Wen Xichang <wenxichang>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by dcvmoole (Posted a comment)
  • -unavailable- added by goldsimon (Posted a comment)
  • -unavailable- added by wenxichang (Submitted the item)
  • -unavailable- added by wenxichang
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 15 Dec 2016 09:34:37 PM UTCgoldsimonStatusNeed Info=>Fixed
      Open/ClosedOpen=>Closed
    Thu 15 Dec 2016 11:47:44 AM UTCgoldsimonStatusNone=>Need Info
      Assigned toNone=>goldsimon
    Thu 15 Dec 2016 10:00:27 AM UTCwenxichangCarbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup1