2

When trying to insert new attachments, sometimes I come across this error:

Insert failed. First exception on row 1; first error: UNKNOWN_EXCEPTION, BlobField : U#360.3fffffff (Attachment) U#360.aff (Body) got exception lib.http.storage.HttpFileStore$FileStoreActionException: Unable to complete action on FileStore in allotted time (timeout=600000 msec, took 10009 msecs)

This seems like a rare error since I haven't been able to find others who have met this issue.

Function to create attachment:

public static Attachment getAttachment(String body, String filename) {
    Attachment att = new Attachment();
    att.Body = Blob.valueOf(body);
    att.Name = fileName;
    return att;
}

Call the function:

Attachment att = getAttachment(JSON.serialize(testBody), 'Test.txt');
insert att;  

where testBody is an instance of Map

6
  • Can you post your code or some more information?
    – Arabinda
    Oct 15 '19 at 5:59
  • @Arabinda yes I've edited the code in Oct 15 '19 at 6:18
  • Are you getting this error consistently? Is it on a single org? How big is testBody variable?
    – rael_kid
    Oct 15 '19 at 6:26
  • @rael_kid it is on a single org. It happened only in one period but there were about 75 error logs. testBody varies. Sometimes it's just a normal JSON array (3 or 4 arrays, less than a MB in file size) and sometimes it can be a pdf file of 100 rows. Oct 15 '19 at 6:29
  • If it was just during a single period it may be related to a Salesforce performance issue.
    – rael_kid
    Oct 15 '19 at 6:31
1

You would need to detect this specific error condition and then handle the timeout in the way that makes sense for your business logic.

You could check for the string "Unable to complete action on FileStore in allotted time" and then retry the operation using a simple max retry count or exponential backoff algorithm.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.