0

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.

Loredra L
  • 1,485
  • 2
  • 16
  • 32

1 Answers1

1

please use AQL traversals for better performance and less limits with V8 execution.

V8 has a limit of 256 MB for strings, and it seems that for larger traversals this limit may be hit by the old traversal implementation, and sadly there is not much we can do about this.

Other users have had similar observations

dothebart
  • 5,972
  • 16
  • 40