Wiced HTTP Client Error

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
RoMc_863046
Level 3
Level 3
25 sign-ins 10 replies posted 10 sign-ins

Hello,

When using the Wiced HTTP Client, occasionally when calling http_client_connect(), it returns an error.  Typically the error code is #4.  

RESULT_ENUM( prefix, ERROR,                          4 ),   /**< Error */  
 
Most recently, it returned a #5031 error followed by a #4 error on all subsequent attempts.
 
RESULT_ENUM( prefix, HANDSHAKE_TIMEOUT,                   5031 ),   /**<   */ \
 
Once this happens, I cannot make any HTTP client connections without shutting down the network ( wiced_network_down() ) and bringing it back up again ( wiced_network_up() ) or resetting the WiFi module.  Both methods involve leaving the AP and re-joining.  I'd like to know:
 
1: What is triggering this error condition.
2: How can I recover without leaving the AP or resetting the module?
 

Laird Sterling EWB ( Cypress CYW4343W + STM32F412)

Wiced Studio 6.6

-Rocko

0 Likes
1 Solution
RoMc_863046
Level 3
Level 3
25 sign-ins 10 replies posted 10 sign-ins

Hello Murali,

I have made good progress.
As I mention before, I found when a socket error occurs I was exiting early and not cleaning up the socket resources and a semaphore properly. The next time through, I didn't have a clean start which caused every packet thereafter to fail.  I tested over 17 hours sending a packet every 10 seconds. I received a single 5031 (HANDSHAKE_TIMEOUT) error.  I am now properly handling the error and I can continue to operate without issue.

I will close this thread and open a new one if I require assistance with the 5031 issue.

Thank you,
-Rocko

View solution in original post

0 Likes
4 Replies
RoMc_863046
Level 3
Level 3
25 sign-ins 10 replies posted 10 sign-ins

*UPDATE*

On a recent test, after 360 successful calls of  http_client_connect(), I've triggered an error.

This time I received error #7014 followed by a error #4 on all subsequent attempts.

RESULT_ENUM( prefix, SOCKET_CLOSED, 7014 ), /**< Socket closed */

 

-Rocko

0 Likes
Murali_R
Moderator
Moderator
Moderator
250 sign-ins 250 replies posted 100 solutions authored

@RoMc_863046 Looks like this is some issue that is popping up when put under a stress test. Is this the default httpbin_org app that is available or have there been any customizations?

Can you provide me the steps to try and reproduce this?
Also, i'll need some debug logs from this. Can you enable WICED NETWORK and LIB INFO,DEBUG and ERROR logs in wiced_defaults.h and provide the logs. This might help in isolating the root cause.

 

Thanks

0 Likes

Thank you for the quick reply MuraliR_36.

This is not the default httpbin_org app.  This is a custom solution.   Since the error occurs randomly, I created a stress test to try and re-create the errors more regularly.  The number of cycles seems unimportant.  I have a test running now on cycle #1800 without any error.

While I have not determined what causes the error, I have found a few issues in my code.  After the error occurs, I was not calling http_client_deinit() before trying to init the client again.  I was also not using a wiced semaphore properly.   This could have been the reason for the subsequent issues after the initial error.  I am now doing a proper cleanup before trying to re-connect.

I will work on creating the debug logs you have requested.

Thank you,

-Rocko

0 Likes
RoMc_863046
Level 3
Level 3
25 sign-ins 10 replies posted 10 sign-ins

Hello Murali,

I have made good progress.
As I mention before, I found when a socket error occurs I was exiting early and not cleaning up the socket resources and a semaphore properly. The next time through, I didn't have a clean start which caused every packet thereafter to fail.  I tested over 17 hours sending a packet every 10 seconds. I received a single 5031 (HANDSHAKE_TIMEOUT) error.  I am now properly handling the error and I can continue to operate without issue.

I will close this thread and open a new one if I require assistance with the 5031 issue.

Thank you,
-Rocko

0 Likes