wso2timeoutwso2-api-managerapache-synapse

WSO2 AM endpoint timeout doesn't work correctly


In my case, I did a test with calling an API. Following is my selected logs:

2020-10-05 15:38:43,585 - sThroughMessageProcessor-12 - DEBUG g.apache.synapse.core.axis2.Axis2FlexibleMEPClient: [] Setting Timeout for endpoint : Endpoint [IDGen--v1.0_APIproductionEndpoint], URI : http://localhost:8082/sequence/batchId/next?length=20 to static timeout value : 15000
...
2020-10-05 15:39:03,660 - sThroughMessageProcessor-13 - DEBUG .apache.synapse.core.axis2.SynapseCallbackReceiver: [] Callback removed for request message id : urn:uuid:be12d50b-503b-4095-a296-ee36f9964d29. Pending callbacks count : 0
2020-10-05 15:39:03,661 - sThroughMessageProcessor-13 - DEBUG .apache.synapse.core.axis2.SynapseCallbackReceiver: [] Synapse received an asynchronous response message

You could see that, we set an endpoint timeout to 15s. And, the logs show that the callback was created at 15:38:43, and removed at 15:39:03, so it takes 20 seconds.

During monitoring, I found it works correctly but sometimes I works incorrectly.

Could you suggest any way I could investigate the root cause ?

PS: I set

'synapse.global_timeout_interval'=600000
'http.socket.timeout'=610000

Solution

  • Registered callbacks are not removed just after the endpoint timeout. There is a timeout handler it keeps checking the response and endpoint timeout periodically. So timeout_handler_interval[1] is used to define this timeout and there can be a delay to remove registered callback. Reducing this value can reduce this delay but it is an overhead to GW.

    So what you experience is not an issue and expected behavior with synapse gateway.

    [1] https://docs.wso2.com/display/EI611/Configuring+synapse.properties