2 Replies Latest reply on Mar 31, 2017 3:31 AM by chikashi RSS
    rohitk Explorer

    Timeout Problem by C SDK Agent

    Hi,

    We developed a C Agent using TW C SDK, we are facing the below problem of timeout.

    We are making call to the TW Server using below API, in which we have used the default timeout value.

    twApi_PushProperties(TW_THING, thingNameToProcess, proplist, -1, FALSE);

     

    Could anyone please help us on below queries:

    a) what is the default timeout value used in the above API

    b) We also noticed error "sendCtlFrame: Error writing to socket.  Error: 32", is this related to the TIME_OUT error or is there any other error due to which TIME OUT is happening.

    Below is the snippet of the log generated at the device ->

     

    [TRACE] 2017-03-20 15:48:53,882: twMessage_Send: Message with RequestId 4 sent successfully

    [DEBUG] 2017-03-20 15:48:53,951: sendCtlFrame: >>>>> Sending Ping. Msg: 14:48:53

    [WARN ] 2017-03-20 15:48:54,46: sendCtlFrame: Error writing to socket.  Error: 32

    [DEBUG] 2017-03-20 15:48:54,46: twTlsClient_Reconnect: Re-establishing SSL context

    [DEBUG] 2017-03-20 15:48:54,47: twWs_Receive: Not connected

    [WARN ] 2017-03-20 15:48:54,47: api:sendMessageBlocking: Receive failed.

    [WARN ] 2017-03-20 15:48:54,47: api:sendMessageBlocking: Message 4 timed out

    [DEBUG] 2017-03-20 15:48:54,47: twMessage_Delete:  Deleting BIND Message: 4

    [DEBUG] 2017-03-20 15:48:54,411: twTlsClient_Connect: Connecting to server

    [DEBUG] 2017-03-20 15:48:54,862: twTlsClient_Connect: TLS connection established

    [ERROR] 2017-03-20 15:48:59,47: connect to platform: Server connection failed after 3 attempts.  Error Code: 1114

      • Re: Timeout Problem by C SDK Agent
        takaaki Explorer

        As for your question a), the default TO is 10000 ms. This is defined as DEFAULT_MESSAGE_TIMEOUT in twDefaultSettings.h.

        Regarding b), "sendCtlFrame: Error writing to socket.  Error: 32" indicates that it failed with "Broken Pipe" Error and other following outputs are showing that attempts to reconnect with Thingworx Platform failed.

        It might be helpful to review CommunicationLog.log on your Thingworx Platform to find how reconnection was happening during the time period.

        • Re: Timeout Problem by C SDK Agent
          chikashi Explorer

          I saw the log.

           

          [DEBUG] 2017-03-20 15:48:53,951: sendCtlFrame: >>>>> Sending Ping. Msg: 14:48:53

          [WARN ] 2017-03-20 15:48:54,46: sendCtlFrame: Error writing to socket.  Error: 32

           

          [WARN ] 2017-03-20 15:48:54,47: api:sendMessageBlocking: Receive failed.

          [WARN ] 2017-03-20 15:48:54,47: api:sendMessageBlocking: Message 4 timed out

           

          [ERROR] 2017-03-20 15:48:59,47: connect to platform: Server connection failed after 3 attempts.  Error Code: 1114

           

           

          Ping request has got timeout within 1 sec, so I suspect  that "DEFAULT_SOCKET_READ_TIMEOUT"

          Could you try increase the value and see if the issue will be solved or not?

           

          /tw-c-sdk/src/config/twDefaultSettings.h

          #define DEFAULT_SOCKET_READ_TIMEOUT     100