`StackOverflowException` in test on `macOS`
We have a test crashing with StackOverlowException on macOS: https://github.com/dotnet/fsharp/pull/13097 (Logs)
In this test (it already has a comment, that it crashes with SO):
https://github.com/dotnet/fsharp/blob/7de9637f8d7839c2312748dcbbabb4cda7455548/tests/FSharp.Compiler.ComponentTests/Conformance/RecordTypes/RecordTypes.fs#L29-L35
The active test run was aborted. Reason: Test host process crashed : Stack overflow.
at FSharp.Compiler.LowerCallsAndSeqs.LowerComputedListOrArrayExpr(Microsoft.FSharp.Core.FSharpFunc`2<ValRef,Microsoft.FSharp.Core.FSharpFunc`2<ValUseFlag,Microsoft.FSharp.Core.FSharpFunc`2<Microsoft.FSharp.Collections.FSharpList`1<TType>,Microsoft.FSharp.Core.FSharpFunc`2<FSharp.Compiler.Text.Range,System.Tuple`2<Expr,TType>>>>>, TcGlobals, ImportMap, Expr)
at FSharp.Compiler.IlxGen.GenExprPreSteps(cenv, CodeGenBuffer, IlxGenEnv, Expr, sequel)
at FSharp.Compiler.IlxGen.GenExprAux(cenv, CodeGenBuffer, IlxGenEnv, Expr, sequel)
at [email protected](Microsoft.FSharp.Core.Unit)
at FSharp.Compiler.ErrorLogger+StackGuard.Guard[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Microsoft.FSharp.Core.FSharpFunc`2<Microsoft.FSharp.Core.Unit,System.__Canon>)
at FSharp.Compiler.IlxGen.GenExpr(cenv, CodeGenBuffer, IlxGenEnv, Expr, sequel)
at FSharp.Compiler.IlxGen.GenBindingRhs(cenv, CodeGenBuffer, IlxGenEnv, Val, Expr)
at FSharp.Compiler.IlxGen.GenBindingAfterDebugPoint(cenv, CodeGenBuffer, IlxGenEnv, Binding, Boolean, Microsoft.FSharp.Core.FSharpOption`1<Mark>)
at FSharp.Compiler.IlxGen.GenLinearExpr(cenv, CodeGenBuffer, IlxGenEnv, Expr, sequel, Boolean, Microsoft.FSharp.Core.FSharpFunc`2<FakeUnit,FakeUnit>)
at FSharp.Compiler.IlxGen.GenExprAux(cenv, CodeGenBuffer, IlxGenEnv, Expr, sequel)
at [email protected](Microsoft.FSharp.Core.Unit)
at FSharp.Compiler.ErrorLogger+StackGuard.Guard[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Microsoft.FSharp.Core.FSharpFunc`2<Microsoft.FSharp.Core.Unit,System.__Canon>)
at FSharp.Compiler.IlxGen.GenExpr(cenv, CodeGenBuffer, IlxGenEnv, Expr, sequel)
at [email protected](CodeGenBuffer, IlxGenEnv)
at FSharp.Compiler.IlxGen.CodeGenThen(cenv, AssemblyBuilder, Microsoft.FSharp.Collections.FSharpList`1<System.Tuple`2<ValRef,BranchCallItem>>, System.String, IlxGenEnv, Int32, Microsoft.FSharp.Core.FSharpOption`1<Val>, Microsoft.FSharp.Core.FSharpFunc`2<CodeGenBuffer,Microsoft.FSharp.Core.FSharpFunc`2<IlxGenEnv,Microsoft.FSharp.Core.Unit>>, FSharp.Compiler.Text.Range)
at FSharp.Compiler.IlxGen.CodeGenMethod(cenv, AssemblyBuilder, Microsoft.FSharp.Collections.FSharpList`1<System.Tuple`2<ValRef,BranchCallItem>>, System.String, IlxGenEnv, Int32, Microsoft.FSharp.Core.FSharpOption`1<Val>, Microsoft.FSharp.Core.FSharpFunc`2<CodeGenBuffer,Microsoft.FSharp.Core.FSharpFunc`2<IlxGenEnv,Microsoft.FSharp.Core.Unit>>, FSharp.Compiler.Text.Range)
at FSharp.Compiler.IlxGen.CodeGenMethodForExpr(cenv, AssemblyBuilder, Microsoft.FSharp.Collections.FSharpList`1<System.Tuple`2<ValRef,BranchCallItem>>, System.String, IlxGenEnv, Int32, Microsoft.FSharp.Core.FSharpOption`1<Val>, Expr, sequel)
at FSharp.Compiler.IlxGen.GenMethodForBinding(cenv, AssemblyBuilder, IlxGenEnv, Val, ILMethodSpec, Boolean, Boolean, ILMemberAccess, Microsoft.FSharp.Collections.FSharpList`1<Typar>, Microsoft.FSharp.Collections.FSharpList`1<Typar>, Microsoft.FSharp.Collections.FSharpList`1<TraitWitnessInfo>, Microsoft.FSharp.Collections.FSharpList`1<Microsoft.FSharp.Collections.FSharpList`1<System.Tuple`2<TType,ArgReprInfo>>>, Microsoft.FSharp.Collections.FSharpList`1<ArgReprInfo>, Microsoft.FSharp.Collections.FSharpList`1<TType>, ArgReprInfo, ValReprInfo, Microsoft.FSharp.Core.FSharpOption`1<Val>, Microsoft.FSharp.Core.FSharpOption`1<Val>, Microsoft.FSharp.Collections.FSharpList`1<Typar>, Microsoft.FSharp.Collections.FSharpList`1<Val>, Expr, TType)
at FSharp.Compiler.IlxGen.GenBindingAfterDebugPoint(cenv, CodeGenBuffer, IlxGenEnv, Binding, Boolean, Microsoft.FSharp.Core.FSharpOption`1<Mark>)
at FSharp.Compiler.IlxGen.GenLinearExpr(cenv, CodeGenBuffer, IlxGenEnv, Expr, sequel, Boolean, Microsoft.FSharp.Core.FSharpFunc`2<FakeUnit,FakeUnit>)
at System.Runtime.CompilerServices.RuntimeHelpers.DispatchTailCalls(IntPtr, Void (IntPtr, IntPtr, System.Runtime.CompilerServices.PortableTailCallFrame*), IntPtr)
at FSharp.Compiler.IlxGen.GenLinearExpr(cenv, CodeGenBuffer, IlxGenEnv, Expr, sequel, Boolean, Microsoft.FSharp.Core.FSharpFunc`2<FakeUnit,FakeUnit>)
at FSharp.Compiler.IlxGen.GenExprAux(cenv, CodeGenBuffer, IlxGenEnv, Expr, sequel)
at [email protected](Microsoft.FSharp.Core.Unit)
at FSharp.Compiler.ErrorLogger+StackGuard.Guard[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Microsoft.FSharp.Core.FSharpFunc`2<Microsoft.FSharp.Core.Unit,System.__Canon>)
at FSharp.Compiler.IlxGen.GenExpr(cenv, CodeGenBuffer, IlxGenEnv, Expr, sequel)
at [email protected](CodeGenBuffer, IlxGenEnv)
at FSharp.Compiler.IlxGen.CodeGenThen(cenv, AssemblyBuilder, Microsoft.FSharp.Collections.FSharpList`1<System.Tuple`2<ValRef,BranchCallItem>>, System.String, IlxGenEnv, Int32, Microsoft.FSharp.Core.FSharpOption`1<Val>, Microsoft.FSharp.Core.FSharpFunc`2<CodeGenBuffer,Microsoft.FSharp.Core.FSharpFunc`2<IlxGenEnv,Microsoft.FSharp.Core.Unit>>, FSharp.Compiler.Text.Range)
at FSharp.Compiler.IlxGen.CodeGenMethod(cenv, AssemblyBuilder, Microsoft.FSharp.Collections.FSharpList`1<System.Tuple`2<ValRef,BranchCallItem>>, System.String, IlxGenEnv, Int32, Microsoft.FSharp.Core.FSharpOption`1<Val>, Microsoft.FSharp.Core.FSharpFunc`2<CodeGenBuffer,Microsoft.FSharp.Core.FSharpFunc`2<IlxGenEnv,Microsoft.FSharp.Core.Unit>>, FSharp.Compiler.Text.Range)
at FSharp.Compiler.IlxGen.CodeGenMethodForExpr(cenv, AssemblyBuilder, Microsoft.FSharp.Collections.FSharpList`1<System.Tuple`2<ValRef,BranchCallItem>>, System.String, IlxGenEnv, Int32, Microsoft.FSharp.Core.FSharpOption`1<Val>, Expr, sequel)
at FSharp.Compiler.IlxGen.GenMethodForBinding(cenv, AssemblyBuilder, IlxGenEnv, Val, ILMethodSpec, Boolean, Boolean, ILMemberAccess, Microsoft.FSharp.Collections.FSharpList`1<Typar>, Microsoft.FSharp.Collections.FSharpList`1<Typar>, Microsoft.FSharp.Collections.FSharpList`1<TraitWitnessInfo>, Microsoft.FSharp.Collections.FSharpList`1<Microsoft.FSharp.Collections.FSharpList`1<System.Tuple`2<TType,ArgReprInfo>>>, Microsoft.FSharp.Collections.FSharpList`1<ArgReprInfo>, Microsoft.FSharp.Collections.FSharpList`1<TType>, ArgReprInfo, ValReprInfo, Microsoft.FSharp.Core.FSharpOption`1<Val>, Microsoft.FSharp.Core.FSharpOption`1<Val>, Microsoft.FSharp.Collections.FSharpList`1<Typar>, Microsoft.FSharp.Collections.FSharpList`1<Val>, Expr, TType)
at FSharp.Compiler.IlxGen.GenBindingAfterDebugPoint(cenv, CodeGenBuffer, IlxGenEnv, Binding, Boolean, Microsoft.FSharp.Core.FSharpOption`1<Mark>)
at FSharp.Compiler.IlxGen.GenLinearExpr(cenv, CodeGenBuffer, IlxGenEnv, Expr, sequel, Boolean, Microsoft.FSharp.Core.FSharpFunc`2<FakeUnit,FakeUnit>)
at System.Runtime.CompilerServices.RuntimeHelpers.DispatchTailCalls(IntPtr, Void (IntPtr, IntPtr, System.Runtime.CompilerServices.PortableTailCallFrame*), IntPtr)
at FSharp.Compiler.IlxGen.GenLinearExpr(cenv, CodeGenBuffer, IlxGenEnv, Expr, sequel, Boolean, Microsoft.FSharp.Core.FSharpFunc`2<FakeUnit,FakeUnit>)
at FSharp.Compiler.IlxGen.GenExprAux(cenv, CodeGenBuffer, IlxGenEnv, Expr, sequel)
at [email protected](Microsoft.FSharp.Core.Unit)
at FSharp.Compiler.ErrorLogger+StackGuard.Guard[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Microsoft.FSharp.Core.FSharpFunc`2<Microsoft.FSharp.Core.Unit,System.__Canon>)
at FSharp.Compiler.IlxGen.GenExpr(cenv, CodeGenBuffer, IlxGenEnv, Expr, sequel)
at [email protected](CodeGenBuffer, IlxGenEnv)
at FSharp.Compiler.IlxGen.CodeGenThen(cenv, AssemblyBuilder, Microsoft.FSharp.Collections.FSharpList`1<System.Tuple`2<ValRef,BranchCallItem>>, System.String, IlxGenEnv, Int32, Microsoft.FSharp.Core.FSharpOption`1<Val>, Microsoft.FSharp.Core.FSharpFunc`2<CodeGenBuffer,Microsoft.FSharp.Core.FSharpFunc`2<IlxGenEnv,Microsoft.FSharp.Core.Unit>>, FSharp.Compiler.Text.Range)
at FSharp.Compiler.IlxGen.C
So the test only recently moved to ComponentTests, in https://github.com/dotnet/fsharp/pull/12985. So only recently started running on MacOS
So I guess we have an edge condition somehow where we're at the stack limit for MacOS.
I think it must be some variation in the size of the stack at the calling point, likely due to the test framework
For some reason (e.g. concurrent processing of tests) there sometimes are more stack frames, and the overall then blows the stack
Going to close it, haven't seen it in a while. Likely fixed with stackguard/changes to coreclr. Nothing actionable for us here at this point.