lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Assertion on Select


From: Jens Nielsen
Subject: Re: [lwip-users] Assertion on Select
Date: Thu, 30 Jul 2015 23:21:39 +0200
User-agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

Hi Sandra

(In case you didn't solve this already)

Do you ever get the assert that is a couple of lines above the one you had? (LWIP_ASSERT("sock != NULL", sock != NULL);)

Is the thread that asserts selecting on the socket that is closed? Or is any thread selecting on a socket closed by any other thread? I can see this happening if thread A selects on fd x, thread B calls lwip_close on fd x, any thread opens/accepts new socket and gets fd x. Then, depending on what happens next, some thread should hit your assert. But in that case I think you should get the "sock != NULL" assert sometimes as well, for the case when the fd isn't reallocated.

However, git master seems to deal with this (also fixed in #43361) so you might want to give that a try

BR /Jens


On 2015-07-24 10:28, Sandra Gilge wrote:
Hi,

regarding my Problem with the assertion on select:
I'm using the IP stack in several tasks (Webserver, SIP, mDNS, TFTP,
MODBUS).
But every task uses its own sockets. Still there seems to be a problem with
multithreading.
The problem occurs (sporadically) in one task, when another socket is closed
in another task.

It seems that the error NEVER occurs, when SO_REUSE is disabled. (mDNS for
example uses SO_REUSEADDR, so I enabled it recently)
Could it be that the socket is reused before it is really closed and the
select_waiting is set to zero (by doing the new connection) but there is one
more select (by the just closed connection)?

I'm still hoping for answers.

Best regards,
Sandra



-----Ursprüngliche Nachricht-----
Von: address@hidden
[mailto:address@hidden Im Auftrag von
address@hidden
Gesendet: Mittwoch, 22. Juli 2015 18:00
An: address@hidden
Betreff: lwip-users Digest, Vol 143, Issue 16

Send lwip-users mailing list submissions to
        address@hidden

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.nongnu.org/mailman/listinfo/lwip-users
or, via email, send a message with subject or body 'help' to
        address@hidden

You can reach the person managing the list at
        address@hidden

When replying, please edit your Subject line so it is more specific than
"Re: Contents of lwip-users digest..."


Today's Topics:

    1. Assertion on select (Sandra Gilge)
    2. Re: lwip-users Digest, Vol 143, Issue 10 (Xun Chen)


----------------------------------------------------------------------

Message: 1
Date: Wed, 22 Jul 2015 14:11:04 +0200
From: "Sandra Gilge" <address@hidden>
To: <address@hidden>
Subject: [lwip-users] Assertion on select
Message-ID: <address@hidden>
Content-Type: text/plain; charset="us-ascii"

Hallo

I'm using LWIP 1.4.1 and the Blackfin VDK port from analog devices (which is
originally for 1.4.0). I moved on to 1.4.1 on my own.

Now I'm having problems with following assertion when calling select.

LWIP_ASSERT("sock->select_waiting >= 0", sock->select_waiting >= 0);

I have several threads that use the socket interface. For me it looks like a
thread safety problem, but SYS_ARCH_PROTECT is implemented.

Has anybody a hint what could go wrong?

Best Regards,

Sandra

-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.nongnu.org/archive/html/lwip-users/attachments/20150722/a35eba
fa/attachment.html>

------------------------------

Message: 2
Date: Wed, 22 Jul 2015 09:41:56 -0400
From: Xun Chen <address@hidden>
To: address@hidden
Subject: Re: [lwip-users] lwip-users Digest, Vol 143, Issue 10
Message-ID: <address@hidden>
Content-Type: text/plain; charset=windows-1252; format=flowed

Hi Sergio,

I took your suggestion of only sending out more data in tcp_sent callbak and
rewrite the codes

And I run into another problem: The data stream is very jerky (I am
streaming 200kb/s)

So I used a scope to see how often the tcp_sent callback is invoked, it
turns out:

I will get about 10-20 callbacks within a short burst of 5 to 10ms, then
there is NO callback for 200ms, then repeat

I tried to tune lwip based on various previous suggestions on the forum and
didn't have much luck.

With this callback frequency, it is impossible to plot data in real time
smoothly (data acquisition application)

Any suggestion? Thanks!

Chen

On 7/11/2015 12:00 PM, address@hidden wrote:
Send lwip-users mailing list submissions to
        address@hidden

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.nongnu.org/mailman/listinfo/lwip-users
or, via email, send a message with subject or body 'help' to
        address@hidden

You can reach the person managing the list at
        address@hidden

When replying, please edit your Subject line so it is more specific
than "Re: Contents of lwip-users digest..."


Today's Topics:

     1. Re: Retransmit too quick? (Sergio R. Caprile)


----------------------------------------------------------------------

Message: 1
Date: Fri, 10 Jul 2015 13:31:37 -0300
From: "Sergio R. Caprile" <address@hidden>
To: address@hidden
Subject: Re: [lwip-users] Retransmit too quick?
Message-ID: <address@hidden>
Content-Type: text/plain; charset=utf-8

The RAW API is event driven code.
The ACK is handled as an ACK by lwIP. This means the window is
updated, the sent pbufs are freed, and you can send data again.
You can't send more data until you receive an ACK for your window size.
You can't queue more data until lwIP frees pbus (when you receive an ACK).
There is no point in calling the send function when you don't have
room to queue/send more data, this causes CPU hog.
There is no point in calling the send function at specific intervals
(assuming you need to send a big bunch of data); if the ACK gets
received in between the interval, you'll have dead times where nothing
is sent.
The write time to call the send function is when the sent callback is
fired.
You are free to choose and write your app the way you want; but, if it
does not work and you ask for help...
Good luck.




------------------------------

_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users

End of lwip-users Digest, Vol 143, Issue 16
*******************************************


_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users




reply via email to

[Prev in Thread] Current Thread [Next in Thread]