I am posting the answer to this question.
For window user: set DOTNET_DefaultStackSize=200000
For Mac user: export DOTNET_DefaultStackSize=200000
Increasing the default stack size will do.