loading
 
Error in The ReadMessage method in RR_API- C# class
Jacquilene Jacob from United States  [6 posts]
13 year
Hi,

I am trying the Object Recognition module and I am using the C# API to getVariables such as OBJECT_NAME, OBJECT_CONFIDENCE etc.

When I leave the RR on, after an hour or so, I observe an unhandled Socket Exception and IOException error printing on my console window.
After this occurs, the object Recognition module stops working. I do see the recognition happening on the RR software but the getVariable returns 'null'.

I have attached the image of the error.

I also debugged the code to find that the error is thrown from the API method ReadMessage() in the following line.

res = binaryReader.Read(buffer, num, 4096 - num);

If you put a debug point on this line OR have a Thread.Sleep(5000) statement before the above line, the Socket Exception error can be recreated instead of waiting an hour for it to occur.

Please let me know if the RR server disconnects the client I made using the API if there are multiple requests made to it continuously.

If this is not the reason for the error, do let me know what is the fix to handle it and yet keep the RR connected for recognition to happen.

Thanks,
Jacquilene

 
Anonymous 13 year
Jacquilene,

Check quickly to see what the Timeout param is set to in the API tab panel accessed from the Options button. It is possible that if this is not zero then the connection is being terminated from RR.

Also check that the number of threads is larger than 1 (maybe 5) just to be sure that threads are getting put to sleep or hung on a connection.

Let me know if that doesn't make a difference and we'll dig deeper.

STeven.
Jacquilene Jacob from United States  [6 posts] 13 year
Steven,

I set the Timeout to 0 and number of threads to 5 as you suggested and the same error occurred again after 40 minutes.

Looks like the connection is being terminated from RR's side.

How do I fix this?

-Jacquilene
Anonymous 13 year
I am interested in this issue as well. Is there an update on the socket error that is seen?
Anonymous 13 year
Hi,

I gave up on the C# version for now as I could not find a fix yet and I am waiting on Steven's reply.

I tried the Processing version in the API and that seemed to work fine.
However, when I had a UDP.send() line in my code to send these results of the getVariable methods to another machine, I see that the getVariable tends to get null after few minutes when you run it in a while(true) loop.

So again looks like the RR server is disconnecting after a while or timing out.

-Jacquilene
AM_ZEN from United States  [6 posts] 13 year
I never new you could specify a function parameter in terms of (...4096-num ).  

When you exit your program are you certain that it ends the RR thread properly meaning EVERY time you exit both RR and your program you can verify this in the task manager for both RR and your application?  Similarly, if you were to comment out all of your RR API request such as request for camera images/RR_variables within your program except for those used to open and close RR and establish a connection to the API server, will the problem still occur?
Anonymous 13 year
Jacquilene,

Sorry for the delay on this ... we wanted to verify where the problem was before getting back to you. It seems that the socket stuff is working fine (we ran a simple connection for a couple hours without issue) so the next check is if the OR module (which we assume you are using) is causing a small error that is corrupting the network connection.

Can you try running you connection for 40 min without the OR module (disabled) just to see if that is where the issue is?

Be sure to have the most recent download as that module is frequently updated.

Also, we assume you are making the connection to RR on the same machine that is running RR or is the connection over a network?

We'll continue to investigate the issue but having feedback from your situation would help speed up the process.

Thanks,
STeven.
Jacquilene Jacob from United States  [6 posts] 13 year
Hi Steven,

I removed the Object Recognition Module and tried running my connection for 40 mins and gave me the Socket Exception again when it was a little over 40 mins.
I took the version 2.42.12 of RR.
And yes, I am making the connection with RR running on the same machine as the application written using API.

Thanks for looking into this issue and I hope you resolve it.

I have started working with the Processing code but even there the getVariable returns null or mixes up values when it is running for a period of time.
For example,

for the lines below,
String confidence = getVariable("OBJECT_CONFIDENCE");
String objectList = getVariable("OBJECTS");
String matchedPath = getVariable("OBJECTS_PATH");
String winWidth = getVariable("IMAGE_WIDTH");
String winHeight = getVariable("IMAGE_HEIGHT");

and I print the varaibles, windowWidth goes from 320 to 0 and sometimes 240 or null . It mixes up with the values of other variables.

-Jacquilene

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index