Stack Overflow during Fan Out #2180
Replies: 2 comments 4 replies
-
Are you at least able to pinpoint which function the StackOverflow exception is coming from? For example, do you know which sub-orchestration or which activity might be causing it? How large are the inputs or outputs of your activity and or sub-orchestration functions? I'm wondering if data serialization might be a potential source of issues. Your design seems perfectly reasonable to me so I don't have any obvious guesses as to why things wouldn't work. |
Beta Was this translation helpful? Give feedback.
-
I'm almost positive it is happening in the CalculateRows activity function which is the bottom function in the call. It returns void so shouldn't be an output issue. The inputs are rather large as it passes in a set of data that needs to be operated on. It's hard to tell as it just prints out "Stack Overflow" to the console and dies. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a very lengthy set of calculations that I am trying to complete. The way we have to complete these calculations there is a change that occurs in the system. This change causes us to need to update the values of some 500k values in our database. The calculations have to be completed in a hierarchy so I have to make multiple passes through our calculation logic in order to complete this calculation.
I have a ServiceBus triggered function which listens for a message on the bus and subsequently spawns an instance of an orchestration function. This orchestration function then loops through the iterations and for each iteration spawns a sub orchestration to handle that particular iteration. This is how I am spinning off each iteration:
The sub iteration for the instance has alot of work to do, long story short, there are potentially multiple types of calculations that I have to do for each iteration. So I use the fan out pattern as such:
The CalculateExpressionDataGroup method can in some cases have a half million calculations it has to do. This is where I run into problems. I have tried doing the fan out pattern where I split the half million calculations into chunks and follow a similar pattern to the one above. However, if I split the 500k calculations into 5 parallel activity functions that handle 100k values, the individual functions time out. If I split it into say 100 parallel activity functions that each handle 50k calculations, then it runs for awhile but then out of nowhere I get a stack overflow with no stack trace or info on what happened.
What I am doing now is splitting my 500k calculations into 100 different activity function calls, but I am only calling them 5 at a time. Here is the code that I wrote for that:
This code works, and it spins up 5 parallel activity functions and waits for them to execute. Then it picks up the next 5 and continues until it has executed them all. When completing a smaller set, say 100k records, it works fine. When I execute it locally from VS it gets about half way through and just dies with a stack overflow. When I deploy it as a premium function in Azure, it gets about a 1/4 way through and just dies with no messaging on what happened. No error in the console, no error in App Insights.
Beta Was this translation helpful? Give feedback.
All reactions