0

My model executed for the first 800 seconds after which I encounter the following error. Is there a way by which I can increase the stack size in AnyLogic? Is there any other approach I could use to counter the same?

`Exception during discrete event execution:
StackOverflowError
java.lang.StackOverflowError
at com.anylogic.engine.Agent.e(Unknown Source)
at com.anylogic.engine.Agent.h(Unknown Source)
at com.anylogic.engine.Agent.ext(Unknown Source)
at com.anylogic.libraries.processmodeling.OutPort.b(Unknown Source)
at com.anylogic.libraries.processmodeling.OutputBlock.forwardReadyEntityNotification(Unknown Source)
at com.anylogic.libraries.processmodeling.InputBlock$1.a(Unknown Source)
at com.anylogic.libraries.processmodeling.OutPort.a(Unknown Source)
at com.anylogic.libraries.processmodeling.OutPort.b(Unknown Source)
at com.anylogic.libraries.processmodeling.OutputBlock.forwardReadyEntityNotification(Unknown 
Source)
at com.anylogic.libraries.processmodeling.InputBlock$1.a(Unknown Source)
at com.anylogic.libraries.processmodeling.OutPort.a(Unknown Source)
at com.anylogic.libraries.processmodeling.OutPort.b(Unknown Source)
at com.anylogic.libraries.processmodeling.OutputBlock.forwardReadyEntityNotification(Unknown 
Source)`
  • 1
    Are you able to run with an smaller model? Couldn't this actually be an infinite loop, or something you actually need to handle in your code? I don't know anylogic, but maybe [this post](https://stackoverflow.com/questions/3700459/how-to-increase-the-java-stack-size) helps you - it shows how to increase stack for java projects, or maybe [this tutorial](https://www.baeldung.com/jvm-configure-stack-sizes), which I believe is more helpful - related to jvm stack configuration. – Leonardo Alves Machado Oct 28 '21 at 16:54
  • You likely have created an infinite loop, no AnyLogic setting can help you there. You need to debug your model to see where the error is coming from. – Benjamin Oct 28 '21 at 17:11
  • 1
    Thank you Leonardo & Benjamin. You were right in guessing that this error was caused due to an infinite loop. Let me explain what exactly took place. In the simulation model I wanted the truck agents to be diverted to one bay or the other. The trucks can only proceed to a bay when the bay is empty. As there were 2 bays, I created a select output block whose exit on false condition led to another select output block whose exit of false condition led back to the input of the block before the first select output block. In the case when a truck was present at both bays, it led to an infinite loop. – Dhruva Kanwar Oct 29 '21 at 11:07

1 Answers1

-1

I believe that you are using the free trial /(PLE) version of the AnyLogic software as the stack size is limited . The problem can be resolved by downsizing you model in terms of decreasing the number of agents or purchasing the full version here. https://www.anylogic.com/purchase/

  • 1
    There is no Stack size limit for the PLE. StackOverflow errors only occur when infinite loops are triggered, this happens independent of any model settings or PLE restrictions :) – Benjamin Oct 29 '21 at 11:23