anandmudgerikar / tinyos-main

Automatically exported from code.google.com/p/tinyos-main
0 stars 0 forks source link

[patch] CoapUdpServer infinite loop #58

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Issue two or more CoAP requests for valid resources before the first 
resource's second half splitphase is run.
2. Have the second request's second half splitphase complete before the first.
3. Issue another CoAP request.

What is the expected output?
Two properly processed CoAP requests.

What do you see instead?
An infinite loop.

What version of the product are you using? On what operating system?
TinyOS-2.x trunk.

Please provide any additional information below.

The queue handling in CoapUdpServerP.nc is broken. While it can happily insert 
and find nodes at any point in the queue, it always removes the head of the 
queue when it takes something off it, regardless of whether that was the 
correct node or not! When requests complete out-of-order, this in very short 
order then leads to a loop at the queue tail, and all attempts at traversing 
the queue to its end result in an infinite loop (e.g. via 
coap_find_transaction()).

Attached is a patch to properly extract the processed node from the queue. This 
functionality is not needed for the general libcoap queues as they're always 
processed in order, so I put the new coap_extract_node() function into 
CoapUdpServerP.nc rather than libcoap's net.c, even though it provides symmetry 
to coap_insert_node() which resides in net.c.

Original issue reported on code.google.com by jmatts...@dius.com.au on 1 Sep 2011 at 4:11

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by sdh...@gmail.com on 1 Sep 2011 at 11:13

GoogleCodeExporter commented 8 years ago
Thomas is working on it.

Original comment by marku...@gmail.com on 16 Sep 2011 at 8:29

GoogleCodeExporter commented 8 years ago

Original comment by marku...@gmail.com on 16 Sep 2011 at 8:29

GoogleCodeExporter commented 8 years ago
Fixed in r5758. Thanks Steve.

Original comment by marku...@gmail.com on 20 Sep 2011 at 3:16