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

Submitter:  Wen Xichang <wenxichang>
Submitted:  Thu 15 Dec 2016 10:00:27 AM UTC
   
 
Category:  sockets/netconn Severity:  3 - Normal
Item Group:  Faulty Behaviour Status:  Fixed
Privacy:  Public Assigned to:  goldsimon
Open/Closed:  Closed Planned Release:  None
lwIP version:  2.0.0

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>
Group administrator
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>
Group administrator
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>
Group administrator
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>
Group administrator
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>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-12-15 goldsimon StatusNeed Info Fixed
        Open/ClosedOpen Closed
    2016-12-15 goldsimon StatusNone Need Info
        Assigned toNone goldsimon
    2016-12-15 wenxichang Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code