c++azureazure-functionsc++builderc++builder-10.2-tokyo

TAzureBlobService->GetBlob fails on big files


I'm using TAzureBlobService->GetBlob( ) to open text files in Azure. It fails on files over 100M; it fails after 30 seconds with "The connection with the server was terminated abnormally". The files are fine, other apps (in other compilers) are happy. Is there a size or time threshold with GetBlob()?

13 Mar ---

I've posted a little forms app (RAD Studio 10.2.3) that demonstrates the problem here https://www.dropbox.com/s/lbywja0f6ss4o22/GetBlobTest.zip?dl=1 It contains the key to a test storage account with three test files (Test52M.txt, Test117M.txt, Test186M.txt). The small one always succeeds, the middle one sometimes fails, the large one always fails. Fails are always a touch over 30 secs, successes are always less than 30 sec.

The code just establishes a TAzureBlobService (key in the zip) and then the core code is:

// Create a MemoryStream for GetBlob to fill
if(MemoryStream) delete MemoryStream;
MemoryStream = new TMemoryStream();

try
{
    zUPairList props, metadata;
    Service->GetBlob(CtnrName, bname, L"", 0, 0, false, props, metadata, MemoryStream, CloudResponseInfo);
}
catch (Exception &exception)
{
    Result = exception.Message;
    return false;
}

Result = CloudResponseInfo->StatusMessage;
return true;

(zUPairList is a typedef for the long system pairlist classes)

The middle 117M sometimes fails, sometimes succeeds, so it's not a size issue. All fails are a touch over 30 sec so it must be a time limit somewhere.


Solution

  • While the underlying HTTP connection is set up with various timeouts all equating to 60 seconds (see this documentation page for an example of one of those defaults), the important one, the Azure timeout, has a default timeout of 30 seconds.

    Therefore what your sample code is missing is something like this, where Service is your TAzureService reference:

    Service->Timeout = 180;
    

    Please refer to the documentation for further information.