Hi.
We are experiencing an issue with an action that exhausts it's memory, when the payload has a string array with ~1000+ values. The values are all 10 characters. The entire payload is roughly 15 kilobytes.
We send the payload to a 3rd party endpoint, and the response is then used to update values in ACS. It seems to fail before even doing the first action of calling the first 3rd party endpoint, pretty much immediately after being invocated. It's pretty basic and should not use much memory, as far as I can tell.
With fewer than 1000 values there is no issue at all.
We are unable to get the console logs from the action container when this happens, making it very difficult to debug.
This error message is pretty much all the information I can get:
{
"error": "The action container exhausted its memory and was killed with 1 in flight activations"
}
From what I understand, we are nowhere near any memory limitations. How do we go about debugging?
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
On one hand -- I think you could manually up the memory limit for this action to handle your compute loads. https://developer.adobe.com/runtime/docs/guides/using/system_settings/
It is weird that a payload that size is exhausted. Do you have a lot of dependencies in your action?
Views
Replies
Total Likes
Can you share a brief code sample that demonstrates the issue?
Views
Replies
Total Likes
Yeah, but not so many that it should exceed the memory limit. They total up to ~12 mb and the entire project ~21.2 mb. I can see that the max code size, including dependencies, is 22 mb, which is not much more than what is currently used, but should still not reach that limit.
How do can I tell the current memory limit?
Views
Replies
Total Likes
Can you share a brief code sample that demonstrates the issue?
Views
Replies
Total Likes
I can't go into specifics, and can't tell for sure where it breaks as the logs are unavailable when this happens, but I can tell that it breaks pretty early before other APIs are called.
I've obfuscated some logic here, but this is where I believe it fails, as there are no indications of it having fetched results. The large dataset is the "ids".
if (!('data' in params)) {
return response.error('Data is not present as parameter');
}
const data = params.data;
const validationResult = validate(data, INCOMING_DATA_SCHEMA);
if (!validationResult.valid) {
return response.error(validationResult.toString());
}
const uniqueIds = data.map(mappedData => mappedData.Id).filter((val, ind, arr) => arr.indexOf(val) === ind);
let promises = data.map(async(mappedData) => {
//maps to request model, which is then used to fetch results from external API.
let results = await fetchResults({
ids: mappedData.ids.split(','),
//other mapping, independent of size of payload
});
}
Views
Replies
Total Likes
Thanks, it seems you are doing some work to get the uniqueIds, but still iterating over the original data ... not sure if that is the issue, but my approach would be to write some tests make sure fetchResults is called the number of times you expect it to be.
Also, your promises array might not be what you expect, I think you need to wrap that in a Promises.all
const resultArray = await Promise.all(inputArray.map(async (i) => someAsyncFunction(i)));
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies