View Ticket
Not logged in
Ticket Hash: 54f05fa8e33fbf94b26b211030c33086ac1cc35a
Title: StackOverflow exception from Median aggregate function
Status: Closed Type: Incident
Severity: Important Priority: Medium
Subsystem: Extension_Functions Resolution: Out_Of_Community_Support
Last Modified: 2018-01-24 17:00:05
Version Found In: 1.0.88
User Comments:
anonymous added on 2017-12-12 00:20:48: (text/x-fossil-plain)
I am grateful to have used SQLite.

A stack overflow occurred with Median function when the number of row was 347,064.
This error occurred when the data was arranged regularly.
 ex) gradually increase(10,20,30,,,,), gradually decrease(100,99,98,,,,), 

When I looked at the source code, seems to be caused by the map struct getting too deep.
It occurred with recursion of the following function.
 dll:SQLite.Interop.dll (x64)
 function:node_insert(), node_iterate(), node_destroy() (extension-functions.c)

In my debug environment, an error occurred approximately the following number of times.

mistachkin added on 2018-01-24 16:31:07: (text/x-fossil-plain)
Given the recursive nature of these functions, it's very difficult to prevent
stack overflows without completely redesigning them.