Increase timeout for storage service requests
When registering dataset using /registerDataset
some users are getting 400 error. As per the Logs this request is timing out(with the error- Unexpected error sending to URL http://storage/api/storage/v2/records METHOD PUT error java.net.SocketTimeoutException: Read timed out) when it tries to upsertRecord in the Storage.
We have found out that when dataset service is calling storage service and it is taking more than 5 seconds which results in a SocketTimeoutException.
When creating StorageService
instance using StorageFactory
, new HttpClient()
instance is used which has default timeout of 5 seconds. Instead of using new HttpClient
instance HttpClientHandler
instance should have been used which has 60 seconds timeout. This code is present in the core-common library. See attached image for reference.