Query with lots of nullable columns create stack overflow
See original GitHub issueI found this while working with a very, very wide table with lots of nullable columns. The code gen work fine however when it runs you get a stack overflow in the getItem:
Stack overflow.... 1872/2038 -
at DbGen+Scripts+MenyColumns.getItem(Microsoft.Data.SqlClient.SqlDataReader)
at DbGen+Scripts+ExecuteSingleAsync@12450-422.Invoke(Microsoft.Data.SqlClient.SqlDataReader)
at DbGen+Scripts+ExecuteSingleAsync@12450-426.Invoke(Microsoft.Data.SqlClient.SqlDataReader)
at Facil.Runtime.CSharp.GeneratedCodeUtils+<ExecuteQuerySingleAsync>d__8`1[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Facil.Runtime.CSharp.GeneratedCodeUtils+<ExecuteQuerySingleAsync>d__8`1[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], Facil.Runtime.CSharp, Version=0.2.6.0, Culture=neutral, PublicKeyToken=null]].MoveNext(System.Threading.Thread)
at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Runtime.CompilerServices.IAsyncStateMachineBox, Boolean)
at System.Threading.Tasks.Task.RunContinuations(System.Object)
at System.Threading.Tasks.Task`1[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].TrySetResult(System.__Canon)
at System.Threading.Tasks.UnwrapPromise`1[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].TrySetFromTask(System.Threading.Tasks.Task, Boolean)
at System.Threading.Tasks.UnwrapPromise`1[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ProcessInnerTask(System.Threading.Tasks.Task)
at System.Threading.Tasks.Task.RunContinuations(System.Object)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef, System.Threading.Thread)
at System.Threading.ThreadPoolWorkQueue.Dispatch()
I have create a PR with a test that shows this error: https://github.com/cmeeren/Facil/pull/10
I have seen a similar problem when I ported some code over to dotnet core. I think the F# compiler does some function nesting which ticks over a magic stack allowance and throws the error. In my case it was expect computation expressions test which a restructured into a list.
Issue Analytics
- State:
- Created 3 years ago
- Comments:19 (19 by maintainers)
Top Results From Across the Web
Find all the columns which are having null values [duplicate]
This answer is not useful. Save this answer. Show activity on this post. you can try this. SELECT cols FROM table WHERE cols...
Read more >Is it better to create another table to possible null values in ...
The doubt: Is better to create another table and when be necessary to use the image, query the new table? Why is your...
Read more >How to Deal with NULL Values in Standard SQL
Step #2: Understand & Decide · 1. Are all rows NULL for some fields? · 2. Is the same number of rows NULL...
Read more >Nullable columns and performance - sqlsunday.com
We need to talk about the nullable columns in your database. Specifically, because of how NULL values are compared, they can dramatically ...
Read more >Computer Programming: 4 Books in 1 - Python Programming + ...
How to Alter a Column from Null to Not Null in SQL Server. ... DDL Commands - Create - Drop - Alter -...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It only happens with nullable columns as I think the extra if statements create the stack overflow
It seems a but random but it somewhere between 394 to 400 columns but I don’t think that number could be relied upon as it could be depend on how far the call is in the stack?
https://github.com/dotnet/fsharp/issues/11114 was reopened after I confirmed that it was in fact not fixed. However, there is little to do on my part except keep the workaround in place. So I don’t see any reason to reopen this issue.