buglwIP - A Lightweight TCP/IP stack - Bugs: bug #38219, Assert on TCP netconn_write with...

 
 

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

bug #38219: Assert on TCP netconn_write with sndtimeout set

Submitted by:  Marco Jakobs <marcoj>
Submitted on:  Fri 01 Feb 2013 12:13:29 PM UTC  
 
Category: sockets/netconnSeverity: 3 - Normal
Item Group: Crash ErrorStatus: Fixed
Privacy: PublicAssigned to: Simon Goldschmidt <goldsimon>
Open/Closed: ClosedPlanned Release: None
lwIP version: 1.4.1

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

Tue 21 Oct 2014 09:10:46 AM UTC, comment #6:

Yes. I've just committed the fix.

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Tue 21 Oct 2014 08:47:42 AM UTC, comment #5:

Hi,

since I got similar problems, it would be interesting for me, if the fix from Matthias is ok.

Sandra <blindcarboncopy>
Wed 27 Mar 2013 09:54:05 AM UTC, comment #4:

Hi,

i've tried the fix from Matthias and it seems to also fix it in my environment.

@Core-team: Can we treat this as official fix or will it have any side effects?

Marco Jakobs <marcoj>
Mon 18 Feb 2013 01:29:26 PM UTC, comment #3:

I also just ran into this issue. The assert triggers, because msg->conn->current_msg is 0, but msg->conn->write_offset is not.

I tried adding conn->write_offset = 0; in the partial write branch if do_write_more:

#if LWIP_SO_SNDTIMEO
if ((conn->send_timeout != 0) &&
((s32_t)(sys_now() - conn->current_msg->msg.w.time_started) >= conn->send_timeout)) {
write_finished = 1;
if (conn->write_offset == 0) {
/* nothing has been written */
err = ERR_WOULDBLOCK;
conn->current_msg->msg.w.len = 0;
} else {
/* partial write */
err = ERR_OK;
conn->current_msg->msg.w.len = conn->write_offset;
conn->write_offset = 0; /* <= ADDED THIS */
}
} else
#endif /* LWIP_SO_SNDTIMEO */

Which seems to fix my problems.

Matthias Blaicher <mabl>
Fri 01 Feb 2013 01:54:21 PM UTC, comment #2:

Ah, of course ... the connection is BLOCKING!

(Can't edit the entry below)

Marco Jakobs <marcoj>
Fri 01 Feb 2013 01:44:37 PM UTC, comment #1:

> The sndtimeout of a nonblocking TCP connection (incoming) is set to 10ms.


From the post on lwip-users, I thought that the connection was blocking but with send-timeout instead of being nonblocking???

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Fri 01 Feb 2013 12:13:29 PM UTC, original submission:

The sndtimeout of a nonblocking TCP connection (incoming) is set to 10ms.

An application sends a large number of packets on this TCP connection which is using the internet, so ACK packets will need some time to return. So the outgoing TCP packets will fill up the buffer until no space is left.

At this point the next netconn_write will not be able to write its data within the set timeout of 10ms.

Expecting the netconn_write returning with an error (ERR_INPROGRESS), unfortunately i'll get an LWIP-assert in this scenario:

ASSERT: C:/Projekte/HCS-CPU2/Libraries/lwIP/src/api/api_msg.c:1357:already writing or closing

which points into the "do_write" function in api_msg.c

Additional info: Setting the timeout to 5000ms will make a short pause (blocking) at the same place where 10ms produces the assert, and then continue as soon as a buffer gets freed. This is just to prove that the assert is a result of the sndtimeout running off.

Marco Jakobs <marcoj>

 

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 blindcarboncopy (Posted a comment)
  • -unavailable- added by mabl (Posted a comment)
  • -unavailable- added by goldsimon (Posted a comment)
  • -unavailable- added by marcoj
  • -unavailable- added by marcoj (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 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 21 Oct 2014 09:10:46 AM UTCgoldsimonStatusNone=>Fixed
      Assigned toNone=>goldsimon
      Open/ClosedOpen=>Closed
    Fri 01 Feb 2013 12:13:30 PM UTCmarcojCarbon-Copy-=>Added marcoj

    Back to the top


    Powered by Savane 3.1-cleanup1