[En-Nut-Discussion] send UDP packet will cause Hang

ivesworking ivesworking at hotmail.com
Tue Dec 27 21:53:12 CET 2005


Hi,
  I already fix that problem, it seem because of each thread i establish are 
consume more memory then i calculating,
the system will stall if it surdent found location not found, (if not found 
it will consume some extra memory [that's y lead my calculation error on 
memory handling], but i not sure y) for a short period.

I also have observ on ethereal what is the last moment when it stall, the 
last packet i receive are half of the packet are transmitted, then it stall.

In my case i got around 30 thread which each have around 60 packet on queue 
that waiting to send out. which will make each queue fight for processing 
power to send out data.
my current solution was limit 6 of the 30 thread go in to the udpsend 
procedure, to avoid the processing power (let the schedule less heave to 
switching)  become critical.


My conclusion here was, when the connection are loss, the udp thread will 
consume a little bit more memory and processing power, if running too many 
thread, we need to be very careful on accuratecy on memory it will consume, 
my previous test show that if i terminate the receiving program on the pc, 
it will create a vacuum effect on the system, which surdenly drop the memory 
and processing power that let the scheduler cannot return to normally 
scheduling. between half of the way to create a stable code, i try to reduce 
those udpsent thread to priority 200, it seem it will return to work.

one thing for sure is the udpsent will consume the processing power a bit 
higher, and when connection is lost, it consume futher higher, and using 
some extra memory for something (this happen in a short time).

However my flooding test been final, and everything seem stable that my 
program now able to survive for some DDOS attack on the udp communication.

wfloh












----- Original Message ----- 
From: "Ernst Stippl" <ernst at stippl.org>
To: "'Ethernut User Chat (English)'" <en-nut-discussion at egnite.de>
Sent: Tuesday, December 27, 2005 8:05 PM
Subject: AW: [En-Nut-Discussion] send UDP packet will cause Hang


Hi!

Have you tried to used Ethereal to see what's actual going on on the network
link? Is the IP layer somehow "stalled" due to the PC-side program's
termination?

If I understand you right, you say the whole setup is working as long as the
pc-side program is running.

This would lead me to try to find out what on the network link actually
changes when the program terminates.

regards
ernst

-----Ursprüngliche Nachricht-----
Von: en-nut-discussion-bounces at egnite.de
[mailto:en-nut-discussion-bounces at egnite.de] Im Auftrag von ivesworking
Gesendet: Montag, 19. Dezember 2005 15:19
An: Ethernut User Chat (English)
Betreff: Re: [En-Nut-Discussion] send UDP packet will cause Hang

ok, i give more detail on the program flow

request side =PC
Response side = ethernut

first i create a listening on the board who handle request after the request
verify, it will send out UDP packet as response, after the UDP packet send,
the program will terminate this listenning and response are all happen is
around 5 second.
the program no need any response after the UDP packet send out.

the listening can handle up to 8K of the incoming, (i set the UDP buffer) on
theory (and tested)it can handle 32 request in very short period(around 1
second)
(request packet around 256 byte)

the response are done in thread, which mean around 32 thread created for
sending response.
each of the response thread can be send up to 50packet to the request side.

so now the total packet on queue on this 32 thread have around 1600packet
that will be send out within 5 second.

due to UDP send out are by port and address, on the request side, i close
the port by terminate the program on listening, on the ethernut side, it
have around 1500 on the quest that sending the packet to no where.

i already program to terminated the thread when udpsend return a -1 value,
However i never see -1 appear,

i run another thread which give a memory print out every 3 second to check
the ethernut board are working fine.

Note: the program work fine and flawless if i try to continue give request,
and my pc program listen to the response.
this happen only when i terminate the program after i send large amount of
request,


PS:i set the program drop response if memory running low, so it will not
harm the system stability.







----- Original Message ----- 
From: "Ernst Stippl" <ernst at stippl.org>
To: "'Ethernut User Chat (English)'" <en-nut-discussion at egnite.de>
Sent: Sunday, December 18, 2005 7:57 PM
Subject: AW: [En-Nut-Discussion] send UDP packet will cause Hang


Hi!

In the UDP protocol, the sender doe snot know if the packet "made it" to the
receiver. So, from this point, a "connection loss" can be
a) a loss of the user protocol which is implemented on top of UDP
b) a loss of the Ethernet carrier wire voltage

You say a ping is still possible, so it can't be b) and if the comms pgm on
the remote side end unexpecteldy, maybe your app within the Ethernut is
still waiting for receiving an UDP package from the comms program - which is
never sees. -> "Freeze" (well not really)
Try to "instrument" you app with some printf's to see exacly what's the
function from which there is no return into your app, maybe that help (you
may need to set timeouts when receiving packets).

regards
Ernst

-----Ursprüngliche Nachricht-----
Von: en-nut-discussion-bounces at egnite.de
[mailto:en-nut-discussion-bounces at egnite.de] Im Auftrag von ivesworking
Gesendet: Sonntag, 18. Dezember 2005 15:51
An: en-nut-discussion at egnite.de
Betreff: [En-Nut-Discussion] send UDP packet will cause Hang

MY application are using UDP packet as communication, if work flawless.
however on my final debug stage, i found that when the connection of the
other side of the communication loss, the ethernut board will freez.
i know it was possible to ping the destination before sending the packet,
however the connection loss i mention here is the communication program
surdently closed, but the computer still valid to accept ping.

i using 3.4 version of the Nut/OS 200407 Winavr

Wf






_______________________________________________
En-Nut-Discussion mailing list
En-Nut-Discussion at egnite.de
http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion

_______________________________________________
En-Nut-Discussion mailing list
En-Nut-Discussion at egnite.de
http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
_______________________________________________
En-Nut-Discussion mailing list
En-Nut-Discussion at egnite.de
http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion

_______________________________________________
En-Nut-Discussion mailing list
En-Nut-Discussion at egnite.de
http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion



More information about the En-Nut-Discussion mailing list