buglwIP - A Lightweight TCP/IP stack - Bugs: bug #44595, netconn_recv does not set last_err...

 
 

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

bug #44595: netconn_recv does not set last_err on CLOSE_WAIT

Submitted by:  Ivan Delamer <idelamer>
Submitted on:  Fri 20 Mar 2015 08:50:07 PM UTC  
 
Category: sockets/netconnSeverity: 3 - Normal
Item Group: Faulty BehaviourStatus: Fixed
Privacy: PublicAssigned to: Simon Goldschmidt <goldsimon>
Open/Closed: ClosedPlanned Release: None
lwIP version: git head

Wed 19 Apr 2017 07:18:10 PM UTC, comment #4:

Should be fixed by now: netconn_recv() doesn't contain that check any more, netconn_recv_data() does the right thing and netconn->last_err has been removed when fixing fatal errors and pending errors.

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Wed 12 Apr 2017 10:43:48 AM UTC, comment #3:

The behaviour of this might have changed. Need to re-check this

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Thu 10 Mar 2016 08:22:39 PM UTC, comment #2:

This cannot be fixed without fixing task #13922 (Remove fatal error handling):

when setting conn->last_err to ERR_CLSD (which is FATAL), we would effectively block writing more data.

I've removed the error so that ERR_CLSD should be returned. Note that calling 'netconn_recv_tcp_pbuf()' is faster for TCP as there is no need for netbufs in the TCP case.

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Fri 20 Mar 2015 09:04:33 PM UTC, comment #1:

The problem of not setting last_err actually got worse with my last cleanup of fixing race conditions in that area. I've decided to prefer fixing race conditions over setting last_err and discussing the arising problems seperately (like here :)

The problematic calls are recv and accept, as these are done in the application thread, not in the tcpip_thread.

The problem is that we have to watch out for race conditions when writing to last_err, expecially when writing an err_t that is marked FATAL. (I have to admit though that I never fully got the FATAL thing...)

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Fri 20 Mar 2015 08:50:07 PM UTC, original submission:

In a half closed netconn (we have received FIN), recvmbox is set to invalid.

If we call netconn_recv, it will return ERR_CONN on one of the first lines:

LWIP_ERROR("netconn_recv: invalid recvmbox", sys_mbox_valid(&conn->recvmbox), return ERR_CONN;);

This should actually pass, and then netconn_recv_data is called. In there, we check:

if (!sys_mbox_valid(&conn->recvmbox)) {
/* This happens when calling this function after receiving FIN */
return sys_mbox_valid(&conn->acceptmbox) ? ERR_CONN : ERR_CLSD;
}

But in neither of both cases do we set last_err. So when I call netconn_err(pxNetconn) I still get ERR_OK.

Ivan Delamer <idelamer>
Project Member

 

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 goldsimon (Posted a comment)
  • -unavailable- added by idelamer (Submitted the item)
  •  

    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
    Wed 19 Apr 2017 07:18:10 PM UTCgoldsimonStatusIn Progress=>Fixed
      Open/ClosedOpen=>Closed
    Wed 12 Apr 2017 10:43:48 AM UTCgoldsimonStatusPostponed=>In Progress
      Assigned toNone=>goldsimon
    Thu 10 Mar 2016 08:22:39 PM UTCgoldsimonStatusNone=>Postponed

    Back to the top


    Powered by Savane 3.1-cleanup1