I was running an Foxx app under arangoDB 3.3.11. A stressed test was conducted in similar manner;
var traverser=new traversal.Traverser(config);
//Loop through an list of entities and do traversal on each of them
BigArray.forEach(function(e){
var vertex=db._document(e);
traverser.traverse(result,vertex)
})
The traversal itself is nothing special, except its config.visitor
is made to push vertex if and only if some conditions are satisfied.
config.visitor=function(config,result,vertex,path){
//Write a vertex if conditions are right. Vertex normal size json object
if(hashTable[vertex.id])
result.push(vertex);
}
With this, the memory slowly builds up and crashes and return canceled request
{"error":true,"errorMessage":"canceled request","code":410,"errorNum":21}
Together with heap size warnng
reached heap-size limit, interrupting V8 execution (heap size limit 3254779904, used 3140128304)
Is there any caveat in using traversal inside a loop? With small array, the app still works, but with complex and big enough array, the error occurs. I always thought of each traversal sis an independent function and within each iteration the GC sweep in and manage the memory by itself.