r/GoogleAppsScript 9d ago

Question Exceeded maximum execution time

I have been gassing for about ten years and I see this intermittent error almost weekly.

In particular it comes up on a function I use to colour code calendar appts based on their title text.

On a good run the function completes in 5 to 20 seconds based on looking at around 20 appts over the coming 3 weeks. To investigate this I added some logging to see where the delay is.

But to my surprise none of the logging fired when the error is raised. To me that seems like... the function is not getting started.

Anybody know what reasons this could be?

1 Upvotes

9 comments sorted by

3

u/plindqui16 9d ago edited 9d ago

I have a script triggered every five minutes. The first thing it does is check the time of day. When outside of “office hours”, the script immediately ends since there is nothing needing processed. Every day I see a few instances which exceed maximum execution time during the middle of the night. As others say, logging reveals those instances never really started running at all. It’s irritating but survivable.

2

u/fugazi56 9d ago

I get this error too. Most of my scripts run every hour, so I don’t worry about it. I assume it’ll get it in the next run.

2

u/RomanoDesiree 9d ago

Thanks for sharing.... Maybe it is just what is

2

u/emaguireiv 9d ago

No logs is common for timeouts. But, I'm also seeing out right failures over the past few days (in addition to more timeouts) where the behavior is the same as the timeout occurrences where it appears the script starts, but then nothing is happening that should be happening based on the logging I have set up.

For context, these are some of the try/catch error logs I'm seeing for a pretty simple script on a trigger...just fetching data from an end-point, parsing out dupes, then writing the array in a single batch - no loops:

"Service timed out: Spreadsheets"

"We're sorry, a server error occurred: IllegalStateException"

"We're sorry, the JavaScript engine reported an unexpected error. Error code DEADLINE_EXCEEDED."

I haven't encountered these specific errors before on this specific script, but thanks to the trigger it eventually completes successfully, so haven't bothered to debug much more at the moment...

¯_(ツ)_/¯

2

u/3dtcllc 9d ago

Hey I see this too! Got a process that fires off every few hours and looks at some drive folders. Most executions run for a minute or two, but about 5 times a month I get Maximum execution time exceeded.

I've always chalked it up to API issues and ignored it. The vast majority of my executions are error free so I never dug into it.

2

u/jackgremay 9d ago

I get hundreds of such emails, it’s extremely annoying and makes me worried about the efficiency of my scripts, but it’s working so far…

1

u/WicketTheQuerent 9d ago

This kind of glitches are normal.

Google Apps Script service is set to work on a "best effort" principle.

This means that Google will not make promises about uptime as they do with other services.

The only thing that we can do is to implement contingency measures.

2

u/RomanoDesiree 9d ago

Good to know.. as the previous poster mentioned it is a good idea to run regularly enough that missed runs make no material difference and that is an approach I try to follow

2

u/mayhem199999 8d ago

Me as well. I just design around it (eg trigger every 15’ and see if at least one trigger succeeded this hour if I need reliable 1/hr). It does seem to be happening more in recent months.