OpenHome Forum
Timeouts in SyncBrowse, SyncSearch, etc? - Printable Version

+- OpenHome Forum (http://forum.openhome.org)
+-- Forum: OpenHome (/forumdisplay.php?fid=1)
+--- Forum: Net (/forumdisplay.php?fid=5)
+--- Thread: Timeouts in SyncBrowse, SyncSearch, etc? (/showthread.php?tid=1126)



Timeouts in SyncBrowse, SyncSearch, etc? - doncross - 24-06-2013 06:38 PM

Hi everyone,

I have been using the C#/.NET version of the ohNet API for the past few months. For the most part, my code is stable and working as intended. I recently received a report that the code exhibited a hang of some kind, but so far we have not been able to reproduce this issue. It occurred to me that the functions SyncBrowse or SyncSearch (in ContentDirectory1) might get stuck. I'm wondering, do these functions have a timeout? If so, how long is it? Is it possible to enable/disable timeouts or adjust their duration?

Looking at the source code for the C# proxies...

http://www.openhome.org/build/nightly/docs/Cs/_cp_upnp_org_content_directory1_8cs_source.html

... I can see that all of the Sync functions involve a semaphore wait with infinite duration, but I don't know if the underlying web services (?) have some kind of network timeout. I know I'm shooting in the dark, but it would help if I could either rule out ohNet Sync calls as a problem, or add code to guard against such problems in shipping code. Any clues would be most welcome.

Thanks,

Don


RE: Timeouts in SyncBrowse, SyncSearch, etc? - simonc - 25-06-2013 08:47 AM

(24-06-2013 06:38 PM)doncross Wrote:  I have been using the C#/.NET version of the ohNet API for the past few months. For the most part, my code is stable and working as intended. I recently received a report that the code exhibited a hang of some kind, but so far we have not been able to reproduce this issue. It occurred to me that the functions SyncBrowse or SyncSearch (in ContentDirectory1) might get stuck. I'm wondering, do these functions have a timeout? If so, how long is it? Is it possible to enable/disable timeouts or adjust their duration?

Hi Don

There are timeouts applied to tcp connect and to reading the action response.

There is no explicit timeout for the action request being written so this could block in theory, at least until the network stack on either control point or device timed out. I'd have thought this was very unlikely however; the control point would only block if the SOAP message was larger than the device's receive buffer and messages for most actions would comfortably fit into the 8k default receive buffer for a tcp socket.

So, it is possible but pretty unlikely that sync actions are causing your hang. I'd guess that a deadlock - either in ohNet and/or your code - is a more likely cause.


RE: Timeouts in SyncBrowse, SyncSearch, etc? - ChriD - 28-06-2013 05:04 PM

i got the same Problem of "stuck Sync" Methods. Most time this happens when i call them in a loop. This wont happen with Async Methods, but then of course the sequence can be corrupted;


RE: Timeouts in SyncBrowse, SyncSearch, etc? - simonc - 28-06-2013 10:21 PM

(28-06-2013 05:04 PM)ChriD Wrote:  i got the same Problem of "stuck Sync" Methods. Most time this happens when i call them in a loop. This wont happen with Async Methods, but then of course the sequence can be corrupted;

I'd like to investigate this. Do you have any example program that (eventually) demonstrates the problem?