question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

maximum recursion depth exceeded

See original GitHub issue

I’m trying to find a way to add bulks of items into the db (something like the COPY postgres https://www.postgresql.org/docs/current/sql-copy.html would be perfect).

When I add 3 items, it works. When I add 100 it fails. When I add 1000, it fails… with a slightly different error message! (InternalServerError: maximum recursion depth exceeded). The while calling a Python object part is missing.

  • EdgeDB Version: 1 alpha 2
  • OS Version: docker image

Steps to Reproduce:

  1. INSERT Index { name := 'idx1' };
WITH idx1 := (SELECT Index FILTER Index.name = 'idx1'),
FOR x IN {
    (<datetime>'2014-10-31T00:02:41+00', 9145.5),
    (<datetime>'2014-10-31T00:02:53+00', 9145.5),
    (<datetime>'2014-10-31T00:02:59+00', 9146.6),
    (<datetime>'2014-10-31T00:03:42+00', 9145.5),
    (<datetime>'2014-10-31T00:03:58+00', 9146.6),
    (<datetime>'2014-10-31T00:04:02+00', 9145.5),
    (<datetime>'2014-10-31T00:04:06+00', 9146.6),
    (<datetime>'2014-10-31T00:04:08+00', 9146.1),
    (<datetime>'2014-10-31T00:04:11+00', 9146.6),
    (<datetime>'2014-10-31T00:05:21+00', 9145.5),
    (<datetime>'2014-10-31T00:09:14+00', 9146.1),
    (<datetime>'2014-10-31T00:09:39+00', 9146.1),
    (<datetime>'2014-10-31T00:09:55+00', 9146.6),
    (<datetime>'2014-10-31T00:10:28+00', 9145.5),
    (<datetime>'2014-10-31T00:12:28+00', 9146.1),
    (<datetime>'2014-10-31T00:12:34+00', 9146.6),
    (<datetime>'2014-10-31T00:12:41+00', 9145.5),
    (<datetime>'2014-10-31T00:14:15+00', 9146.1),
    (<datetime>'2014-10-31T00:14:25+00', 9146.6),
    (<datetime>'2014-10-31T00:15:20+00', 9146.1),
    (<datetime>'2014-10-31T00:15:23+00', 9145.5),
    (<datetime>'2014-10-31T00:15:24+00', 9146.1),
    (<datetime>'2014-10-31T00:15:41+00', 9146.6),
    (<datetime>'2014-10-31T00:15:48+00', 9146.1),
    (<datetime>'2014-10-31T00:15:58+00', 9146.6),
    (<datetime>'2014-10-31T00:16:00+00', 9145.5),
    (<datetime>'2014-10-31T00:16:01+00', 9145.5),
    (<datetime>'2014-10-31T00:16:02+00', 9145.5),
    (<datetime>'2014-10-31T00:16:03+00', 9145.5),
    (<datetime>'2014-10-31T00:16:04+00', 9146.1),
    (<datetime>'2014-10-31T00:16:05+00', 9145.5),
    (<datetime>'2014-10-31T00:16:06+00', 9145.5),
    (<datetime>'2014-10-31T00:16:07+00', 9145.5),
    (<datetime>'2014-10-31T00:16:08+00', 9145.5),
    (<datetime>'2014-10-31T00:16:09+00', 9145.5),
    (<datetime>'2014-10-31T00:16:10+00', 9145.5),
    (<datetime>'2014-10-31T00:16:11+00', 9145.5),
    (<datetime>'2014-10-31T00:16:12+00', 9145.5),
    (<datetime>'2014-10-31T00:16:13+00', 9145.5),
    (<datetime>'2014-10-31T00:16:14+00', 9145.5),
    (<datetime>'2014-10-31T00:16:15+00', 9145.5),
    (<datetime>'2014-10-31T00:16:16+00', 9145.5),
    (<datetime>'2014-10-31T00:16:17+00', 9145.5),
    (<datetime>'2014-10-31T00:16:18+00', 9145.5),
    (<datetime>'2014-10-31T00:16:19+00', 9145.5),
    (<datetime>'2014-10-31T00:16:20+00', 9145.5),
    (<datetime>'2014-10-31T00:16:21+00', 9145.5),
    (<datetime>'2014-10-31T00:16:22+00', 9145.5),
    (<datetime>'2014-10-31T00:16:23+00', 9145.5),
    (<datetime>'2014-10-31T00:16:24+00', 9145.5),
    (<datetime>'2014-10-31T00:16:25+00', 9145.5),
    (<datetime>'2014-10-31T00:16:26+00', 9145.5),
    (<datetime>'2014-10-31T00:16:27+00', 9145.5),
    (<datetime>'2014-10-31T00:16:28+00', 9145.5),
    (<datetime>'2014-10-31T00:16:29+00', 9145.5),
    (<datetime>'2014-10-31T00:16:30+00', 9145.5),
    (<datetime>'2014-10-31T00:16:31+00', 9145.5),
    (<datetime>'2014-10-31T00:16:32+00', 9145.5),
    (<datetime>'2014-10-31T00:16:33+00', 9145.5),
    (<datetime>'2014-10-31T00:16:34+00', 9145.5),
    (<datetime>'2014-10-31T00:16:35+00', 9145.5),
    (<datetime>'2014-10-31T00:16:36+00', 9145.5),
    (<datetime>'2014-10-31T00:16:37+00', 9145.5),
    (<datetime>'2014-10-31T00:16:38+00', 9145.5),
    (<datetime>'2014-10-31T00:16:39+00', 9145.5),
    (<datetime>'2014-10-31T00:16:40+00', 9145.5),
    (<datetime>'2014-10-31T00:16:41+00', 9145.5),
    (<datetime>'2014-10-31T00:16:42+00', 9145.5),
    (<datetime>'2014-10-31T00:16:43+00', 9145.5),
    (<datetime>'2014-10-31T00:16:44+00', 9145.5),
    (<datetime>'2014-10-31T00:16:45+00', 9145.5),
    (<datetime>'2014-10-31T00:16:46+00', 9145.5),
    (<datetime>'2014-10-31T00:16:47+00', 9145.5),
    (<datetime>'2014-10-31T00:16:48+00', 9145.5),
    (<datetime>'2014-10-31T00:16:49+00', 9145.5),
    (<datetime>'2014-10-31T00:16:50+00', 9145.5),
    (<datetime>'2014-10-31T00:16:51+00', 9145.5),
    (<datetime>'2014-10-31T00:16:52+00', 9145.5),
    (<datetime>'2014-10-31T00:16:53+00', 9145.5),
    (<datetime>'2014-10-31T00:16:54+00', 9145.5),
    (<datetime>'2014-10-31T00:16:55+00', 9145.5),
    (<datetime>'2014-10-31T00:16:56+00', 9145.5),
    (<datetime>'2014-10-31T00:16:57+00', 9145.5),
    (<datetime>'2014-10-31T00:16:58+00', 9145.5),
    (<datetime>'2014-10-31T00:16:59+00', 9145.5),
    (<datetime>'2014-10-31T00:28:18+00', 9144.5),
    (<datetime>'2014-10-31T00:28:50+00', 9144.5),
    (<datetime>'2014-10-31T00:38:07+00', 9145.5),
    (<datetime>'2014-10-31T00:38:19+00', 9145.5),
    (<datetime>'2014-10-31T00:38:38+00', 9146.6),
    (<datetime>'2014-10-31T00:38:39+00', 9145.5),
    (<datetime>'2014-10-31T00:38:41+00', 9146.1),
    (<datetime>'2014-10-31T00:38:46+00', 9146.6),
    (<datetime>'2014-10-31T00:38:47+00', 9145.5),
    (<datetime>'2014-10-31T00:38:53+00', 9146.6),
    (<datetime>'2014-10-31T00:38:55+00', 9145.5),
    (<datetime>'2014-10-31T00:40:16+00', 9146.6),
    (<datetime>'2014-10-31T00:44:15+00', 9146.1),
    (<datetime>'2014-10-31T00:44:25+00', 9146.6),
    (<datetime>'2014-10-31T00:45:09+00', 9147.6),
}
UNION (INSERT History {
    index := idx1,
    timestamp := x.0,
    value := x.1
});

Schema:

module default {
    type Index {
        required property name -> str {
            constraint exclusive;
        }
    }

    type History {
        required link index -> Index;
        required property timestamp -> datetime;
        required property value -> float64;
    }
}

Result:

InternalServerError: maximum recursion depth exceeded while calling a Python object
Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md  

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
Mulugruntzcommented, Feb 25, 2020

Thanks @elprans !

It took 56 seconds to insert 73,247 records. Using containers. I’ll do more tests tomorrow 😃.

Time to sleep (past 5am, in HK) thanks for your support!

1reaction
elpranscommented, Feb 25, 2020

Ah, right. Tuples as arguments are currently unsupported (this is a Postgres restriction really). So, one way to implement this is to use JSON as input instead:

WITH idx1 := (SELECT Index FILTER Index.name = 'idx1'),
FOR x IN {json_array_unpack(<json>$json_array)}
UNION (
UNION (INSERT History {
    index := idx1,
    timestamp := <datetime>x[0],
    value := <float64>x[1]
});

Where $json_array is the result of json.dumps(). In this scenario you need to make sure your datetime data is a proper ISO-formatted string that includes the timezone.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is the maximum recursion depth in Python, and how to ...
The recursion limit is usually 1000. – Boris Verkhovskiy. Apr 24, 2019 at 7:29. 4.
Read more >
Python maximum recursion depth exceeded in comparison
The “maximum recursion depth exceeded in comparison” error is raised when you try to execute a function that exceeds Python's built in recursion...
Read more >
Python: Maximum Recursion Depth Exceeded [How to Fix It]
The maximum recursion depth in Python is 1000. To check it, call sys.getrecursionlimit() function. To change it, call sys.setrecursionlimit().
Read more >
Python | Handling recursion limit - GeeksforGeeks
When you execute a recursive function in Python on a large input ( > 10^4), you might encounter a “maximum recursion depth exceeded...
Read more >
Python RecursionError: Maximum Recursion Depth Exceeded ...
A Python RecursionError exception is raised when the execution of your program exceeds the recursion limit of the Python interpreter. Two ways ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found