Deploy fails: "Build exceeded maximum allowed runtime" - with GatsbyJS & Git Push

answered
#1

Briefly summarize the issues you have been experiencing.

I’m creating a GatsbyJS site that will be 11 pages of design project images (including process). Specifically, the projects are thesis projects from a design program I was recently in. So, each person is adding about 15–25 relatively high-res images, and these are generating a pretty big cache once Gatsby. However, I can’t imagine that it’s that much larger than a typical design portfolio or blog might be. The cache is about 675mb so far, which I think mostly comes from images that have been optimized into multiple sizes of thumbnails, each.

Typically, the build gets to about here, then stalls out:

9:47:48 PM: success run static queries — 105.181 s — 7/7 0.07 queries/second
9:47:48 PM: success run page queries — 0.099 s — 15/15 152.49 queries/second
9:47:48 PM: success write out page data — 0.004 s
9:47:48 PM: success write out redirect data — 0.001 s
10:14:02 PM: Build exceeded maximum allowed runtime

I believe this is where images are being processed.

It does work if I use gatsby build && netlify deploy --prod to deploy from my computer.

However, the time I did this, then did a subsequent push to the repo, the automated build acted a little better, getting to here before timing out:

6:25:19 PM: success write out redirect data — 0.002 s
6:51:13 PM: Build exceeded maximum allowed runtime
6:51:29 PM: error UNHANDLED REJECTION
6:51:29 PM: 
6:51:29 PM:   Error: Failed to process image /opt/build/repo/src/projects/katja/assets/katja  _pres_3000x1800-01.png
6:51:29 PM: 
6:51:32 PM: (sharp:1334): GLib-CRITICAL **: 22:51:32.680: g_hash_table_lookup: assertion 'hash_table != NULL' failed
6:51:33 PM: Execution timed out after 15m0s
6:51:33 PM: Error running command: Command did not finish within the time limit
6:51:33 PM: Failing build: Failed to build site

Worst-case scenario, I can build locally and deploy. However, this is not ideal, because I very much hope that my classmates can make changes in the GitHub repo, and that those could automatically trigger a successful rebuild when they are merged in Master. This would make collaboration much more seamless.

Please provide a link to your live site hosted on Netlify

(Please don’t share this out, as it’s a work-in-progress version which we are not yet making public).

What have you tried as far as troubleshooting goes? Do you have an idea what is causing the problem?

I realize that the problem is being caused by the build time exceeding 15 minutes.

I have attempted to solve the issue by clearing out console errors, cleaning up my react components with proper ComponentWillMount state setting, and updating dependencies to prevent build errors.

I also hoped that building & deploying locally might update the server cache and make the server builds work more quickly, but that doesn’t seem to be the case.

Do you have any other information that is relevant, such as links to docs, libraries, or other resources?

This GatsbyJS issue seems to potentially be related, as it describes a hanging process at the same step: Extremely long (25+ min) build time happening randomly.


Is there anything I might be able to do to make these automatic deployments work again, or do they just totally stop working once enough images are being processed?

Thanks for any insights or pointers!

#2

This is self hosted? Or via a centralized git service? I’ve had nothing but an excellent experience using GitLab’s integrated Netlify services for sites, including Gatsby. My only suggestion is to create a second deploy via GitLab’s pages publishing using Netlify. It’s quick, it’s smooth, and easily customizable. :+1:t3:

#3

@intr0 thanks for the reply!

Good question. This is hosted as a private repo on GitHub. I’ve been pretty happy with it, but I am concerned about data and permissions limitations. Also, if it might help with this, maybe I should take a look at GitLab…

2 Likes
#4

@thundernixon,

First of all - awesome name! thundernixon - somehow it eluded me previously. Okay, back to git. It’s definitely worth a go. All it takes is creating an account, choosing the Netlify / GitLab hybrid deploy you’d like to try - might as well try more than one - and simply experiencing the flow. If you do choose to try it out, let us all know how it goes for you. :+1:t3:

(Attachment publicKey - admin@intr0.com - ca04f762bf69348d05e30d2bde125b4e2d10e361.asc is missing)

#5

Hey folks! The usual reason for gatsby builds timing out in that pattern is not that your build actually runs for a long time, but that instead “something” is left running by your build.

[Common Issue] Hung or stuck, but seemingly successful build describes the likely cause and a good debug path :slight_smile:

1 Like