Execution Terminated Error + TimeoutError Error

What I’m trying to do:
My app has gotten a number of users and I am encountering a number of errors. I am working with Jay and Stu on them and sent an email to Anvil support, where Ryan asked me to post about them in the forums. We have checked each of these extensively and couldnt solve them, so would love support!

Here I had 1 session with 2 errors. The main one was the Server code exited unexpectedly. After that happened 4 times I got a “timeoutError: server code took too long”:

anvil.server.ExecutionTerminatedError: Server code exited unexpectedly: e2b1b5d85c

at Edit_LCs.RowTemplate3, line 67

called from Edit_LCs.RowTemplate3, line 67

called from Edit_LCs.RowTemplate3, line 83

anvil.server.ExecutionTerminatedError: Server code exited unexpectedly: e2b1b5d85c

at Edit_LCs.RowTemplate3, line 67

called from Edit_LCs.RowTemplate3, line 67

called from Edit_LCs.RowTemplate3, line 83

anvil.server.ExecutionTerminatedError: Server code exited unexpectedly: e2b1b5d85c

at Edit_LCs.RowTemplate3, line 67

called from Edit_LCs.RowTemplate3, line 67

called from Edit_LCs.RowTemplate3, line 83

anvil.server.ExecutionTerminatedError: Server code exited unexpectedly: e2b1b5d85c

at Edit_LCs.RowTemplate3, line 67

called from Edit_LCs.RowTemplate3, line 67

called from Edit_LCs.RowTemplate3, line 83

posthog event: LC delted: Index 0

anvil.server.TimeoutError: Server code took too long

at Edit_LCs.RowTemplate3, line 67

called from Edit_LCs.RowTemplate3, line 67

called from Edit_LCs.RowTemplate3, line 83

Occurs on a very simple server call:
The call:

ai_text_generated = anvil.server.call('ai_text_generated', lc_id)

@anvil.server.callable
def ai_text_generated(lc_id):
    #returns the learning card text as long as the ai finished and none otherwise
    lc_row = app_tables.learning_cards.get_by_id(lc_id)
    #print(f'lc row found: {lc_row}')
    if lc_row:
        if lc_row['ai_generated'] or lc_row['ai_generated'] == False:
            learning_card = lc_row['learning_card']

            # Check if learning_card is a string
            if not isinstance(learning_card, str):
                raise anvil.server.HttpError(400, f"Non-text data found in learning card {lc_id} with lc_index {lc_row['lc_index']}.")

            # Check the size of learning_card
            size_in_bytes = sys.getsizeof(learning_card)
            max_size_bytes = 4 * 1000 * 1024

            if size_in_bytes > max_size_bytes:
                return "The learning card was too large (>4MB). This is likely because it's a very large picture, which we currently do not support. Please contact us."
                raise anvil.server.HttpError(413, "Data exceeds 4MB limit")
            else:
                return learning_card

    else:
        return None

Time: Wed 17.4 around 21:30 CEST

Session ID:
OAZ4WADAHOBLRE5A2VMZXFU7QSDAWDQC

Remember to follow the code example in

i.e., with ```python before it and ``` afterwards. Otherwise, indentation (which is critical in Python code) is lost.

1 Like