-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Description
Mono runtime issue.
Attempt to execute the following code (originates from Jupyter F# kernel issue)
let n = 100 // 92 and below is fine, 93 and above can cause issues
let float_array = Array.init n (fun _ -> Array.init n (fun _ -> 0.0))
float_array |> Seq.take 12 |> Seq.toArray //Taking 11 items is fine, taking12 items causes exception
with EvalInteractionNonThrowing method of FSharpInteractiveSession (Microsoft.FSharp.Compiler.Interactive.Shell+FsiEvaluationSession.EvalInteractionNonThrowing
) in the code presented below causes StackOverflowException in Mono. Works on Windows.
Steps to Reproduce
- Download and unzip the repro archive
- Run run_repro.sh from it's directory.
(it compiles 3 files with fsharpc, then executes compiled exe to trigger the issue)
The output is :
System info
Linux dmitry-Virtual-Machine 4.15.0-22-generic #24-Ubuntu SMP Wed May 16 12:15:17 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04 LTS
Release: 18.04
Codename: bionic
Mono JIT compiler version 5.12.0.226 (tarball Thu May 3 09:42:09 UTC 2018)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
Interpreter: yes
LLVM: supported, not enabled.
GC: sgen (concurrent by default)
Clearing outputs
Building executable with fsharpc...
Microsoft (R) F# Compiler version 4.1
Copyright (c) Microsoft Corporation. All Rights Reserved.
Gathering dependencies...
Triggering issue by running executable...
Unhandled Exception:
StackOverflowException
[ERROR] FATAL UNHANDLED EXCEPTION: System.StackOverflowException: The requested operation caused a stack overflow.
at (wrapper alloc) System.Object.AllocSmall(intptr,intptr)
at Microsoft.FSharp.Compiler.Layout+addL@388-5[a,b].Specialize[c] () [0x00000] in <5953c78eddab8ea7a74503838ec75359>:0
at Microsoft.FSharp.Compiler.Layout.addL@388-4[b,a,c] (Microsoft.FSharp.Compiler.Layout+LayoutRenderer`2[a,b] rr, a z, System.Int32 pos, System.Int32 i, Internal.Utilities.StructuredFormat.Layout layout, ...
Current Behavior
StackOverflowException is thrown
Expected Behavior
The code is executed without exception.
On which platforms did you notice this
Linux dmitry-Virtual-Machine 4.15.0-22-generic #24-Ubuntu SMP Wed May 16 12:15:17 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04 LTS
Release: 18.04
Codename: bionic
Version Used:
Mono JIT compiler version 5.12.0.226 (tarball Thu May 3 09:42:09 UTC 2018)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
Interpreter: yes
LLVM: supported, not enabled.
GC: sgen (concurrent by default)
Stacktrace
StackOverflowException
[ERROR] FATAL UNHANDLED EXCEPTION: System.StackOverflowException: The requested operation caused a stack overflow.
at (wrapper alloc) System.Object.AllocSmall(intptr,intptr)
at Microsoft.FSharp.Compiler.Layout+addL@388-5[a,b].Specialize[c] () [0x00000] in <5953c78eddab8ea7a74503838ec75359>:0
at Microsoft.FSharp.Compiler.Layout.addL@388-4[b,a,c] (Microsoft.FSharp.Compiler.Layout+LayoutRenderer`2[a,b] rr, a z, System.Int32 pos, System.Int32 i, Internal.Utilities.StructuredFormat.Layout layout, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] k) [0x000eb] in <5953c78eddab8ea7a74503838ec75359>:0
at Microsoft.FSharp.Compiler.Layout+addL@388-5T[a,b,c].Invoke (a z, System.Int32 pos, System.Int32 i, Internal.Utilities.StructuredFormat.Layout layout, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] k) [0x00008] in <5953c78eddab8ea7a74503838ec75359>:0
at Microsoft.FSharp.Core.OptimizedClosures+Invoke@3307-3[T2,T3,T4,T5,TResult,T1].Invoke (T2 u, T3 v, T4 w, T5 x) [0x00001] in <5893d081904cf4daa745038381d09358>:0
at Microsoft.FSharp.Core.OptimizedClosures+Invoke@3301-2[T2,T3,T4,TResult,T1].Invoke (T2 u, T3 v, T4 w) [0x00001] in <5893d081904cf4daa745038381d09358>:0
at Microsoft.FSharp.Core.OptimizedClosures+Invoke@3266-1[T2,T3,TResult,T1].Invoke (T2 u, T3 v) [0x00001] in <5893d081904cf4daa745038381d09358>:0
at Microsoft.FSharp.Core.OptimizedClosures+Invoke@3253[T2,TResult,T1].Invoke (T2 u) [0x00001] in <5893d081904cf4daa745038381d09358>:0
at Microsoft.FSharp.Compiler.Layout.addL@388-4[b,a,c] (Microsoft.FSharp.Compiler.Layout+LayoutRenderer`2[a,b] rr, a z, System.Int32 pos, System.Int32 i, Internal.Utilities.StructuredFormat.Layout layout, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] k) [0x000cb] in <5953c78eddab8ea7a74503838ec75359>:0
at Microsoft.FSharp.Compiler.Layout+addL@388-5T[a,b,c].Invoke (a z, System.Int32 pos, System.Int32 i, Internal.Utilities.StructuredFormat.Layout layout, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] k) [0x00008] in <5953c78eddab8ea7a74503838ec75359>:0
at Microsoft.FSharp.Core.OptimizedClosures+Invoke@3307-3[T2,T3,T4,T5,TResult,T1].Invoke (T2 u, T3 v, T4 w, T5 x) [0x00001] in <5893d081904cf4daa745038381d09358>:0
at Microsoft.FSharp.Core.OptimizedClosures+Invoke@3301-2[T2,T3,T4,TResult,T1].Invoke (T2 u, T3 v, T4 w) [0x00001] in <5893d081904cf4daa745038381d09358>:0
at Microsoft.FSharp.Core.OptimizedClosures+Invoke@3266-1[T2,T3,TResult,T1].Invoke (T2 u, T3 v) [0x00001] in <5893d081904cf4daa745038381d09358>:0
at Microsoft.FSharp.Core.OptimizedClosures+Invoke@3253[T2,TResult,T1].Invoke (T2 u) [0x00001] in <5893d081904cf4daa745038381d09358>:0
at Microsoft.FSharp.Compiler.Layout.addL@388-4[b,a,c] (Microsoft.FSharp.Compiler.Layout+LayoutRenderer`2[a,b] rr, a z, System.Int32 pos, System.Int32 i, Internal.Utilities.StructuredFormat.Layout layout, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] k) [0x0011c] in <5953c78eddab8ea7a74503838ec75359>:0
at Microsoft.FSharp.Compiler.Layout+addL@388-5T[a,b,c].Invoke (a z, System.Int32 pos, System.Int32 i, Internal.Utilities.StructuredFormat.Layout layout, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] k) [0x00008] in <5953c78eddab8ea7a74503838ec75359>:0
at Microsoft.FSharp.Core.OptimizedClosures+Invoke@3307-3[T2,T3,T4,T5,TResult,T1].Invoke (T2 u, T3 v, T4 w, T5 x) [0x00001] in <5893d081904cf4daa745038381d09358>:0
at Microsoft.FSharp.Core.OptimizedClosures+Invoke@3301-2[T2,T3,T4,TResult,T1].Invoke (T2 u, T3 v, T4 w) [0x00001] in <5893d081904cf4daa745038381d09358>:0
at Microsoft.FSharp.Core.OptimizedClosures+Invoke@3266-1[T2,T3,TResult,T1].Invoke (T2 u, T3 v) [0x00001] in <5893d081904cf4daa745038381d09358>:0
at Microsoft.FSharp.Core.OptimizedClosures+Invoke@3253[T2,TResult,T1].Invoke (T2 u) [0x00001] in <5893d081904cf4daa745038381d09358>:0
at Microsoft.FSharp.Compiler.Layout.addL@388-4[b,a,c] (Microsoft.FSharp.Compiler.Layout+LayoutRenderer`2[a,b] rr, a z, System.Int32 pos, System.Int32 i, Internal.Utilities.StructuredFormat.Layout layout, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] k) [0x0011c] in <5953c78eddab8ea7a74503838ec75359>:0
at Microsoft.FSharp.Compiler.Layout+addL@388-5T[a,b,c].Invoke (a z, System.Int32 pos, System.Int32 i, Internal.Utilities.StructuredFormat.Layout layout, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] k) [0x00008] in <5953c78eddab8ea7a74503838ec75359>:0
at Microsoft.FSharp.Core.OptimizedClosures+Invoke@3307-3[T2,T3,T4,T5,TResult,T1].Invoke (T2 u, T3 v, T4 w, T5 x) [0x00001] in <5893d081904cf4daa745038381d09358>:0
at Microsoft.FSharp.Core.OptimizedClosures+Invoke@3301-2[T2,T3,T4,TResult,T1].Invoke (T2 u, T3 v, T4 w) [0x00001] in <5893d081904cf4daa745038381d09358>:0
at Microsoft.FSharp.Core.OptimizedClosures+Invoke@3266-1[T2,T3,TResult,T1].Invoke (T2 u, T3 v) [0x00001] in <5893d081904cf4daa745038381d09358>:0
at Microsoft.FSharp.Core.OptimizedClosures+Invoke@3253[T2,TResult,T1].Invoke (T2 u) [0x00001] in <5893d081904cf4daa745038381d09358>:0
at Microsoft.FSharp.Compiler.Layout.addL@388-4[b,a,c] (Microsoft.FSharp.Compiler.Layout+LayoutRenderer`2[a,b] rr, a z, System.Int32 pos, System.Int32 i, Internal.Utilities.StructuredFormat.Layout layout, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] k) [0x0011c] in <5953c78eddab8ea7a74503838ec75359>:0
at Microsoft.FSharp.Compiler.Layout+addL@388-5T[a,b,c].Invoke (a z, System.Int32 pos, System.Int32 i, Internal.Utilities.StructuredFormat.Layout layout, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] k) [0x00008] in <5953c78eddab8ea7a74503838ec75359>:0
...