Build successfull but timeout later on

Hey, I have an issue with build timeouts. It seems that build is finished

info Done building in 76.171738811 sec.

After that there is a 15+ minutes gap between logs:

1:41:10 PM: info [gatsby-adapter-netlify] Stored the Gatsby cache to speed up future builds. :fire:
1:58:04 PM: Failed during stage โ€œbuilding siteโ€: Command did not finish within the time limit

Can you clarify what exactly is being performed here and how it can be improved?

1:39:46 PM: Netlify Build
1:39:46 PM: โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
1:39:46 PM: โ€‹
1:39:46 PM: โฏ Version
1:39:46 PM: @netlify/build 29.31.1
1:39:46 PM: โ€‹
1:39:46 PM: โฏ Flags
1:39:46 PM: baseRelDir: true
1:39:46 PM: buildId: 6582e067b2a7d709ae4e8b89
1:39:46 PM: deployId: 6582e067b2a7d709ae4e8b8b
1:39:46 PM: โ€‹
1:39:46 PM: โฏ Current directory
1:39:46 PM: /opt/build/repo
1:39:46 PM: โ€‹
1:39:46 PM: โฏ Config file
1:39:46 PM: No config file was defined: using default values.
1:39:46 PM: โ€‹
1:39:46 PM: โฏ Context
1:39:46 PM: branch-deploy
1:39:46 PM: โ€‹
1:39:46 PM: Build command from Netlify app
1:39:46 PM: โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
1:39:46 PM: โ€‹
1:39:46 PM: $ npm run build
1:39:46 PM: > trooper-website@1.0.0 build
1:39:46 PM: > npm run fetch-translations && gatsby build --verbose
1:39:47 PM: > trooper-website@1.0.0 fetch-translations
1:39:47 PM: > node fetch-translations.js
1:39:48 PM: verbose 0.389310726 set gatsby_log_level: โ€œverboseโ€
1:39:48 PM: verbose 0.390279732 set gatsby_executing_command: โ€œbuildโ€
1:39:48 PM: verbose 0.390635274 loading local command from: /opt/build/repo/node_modules/gatsby/dist/commands/build.js
1:39:49 PM: verbose 1.189944506 running command: build
1:39:49 PM: verbose 1.190850009 Running build in โ€œproductionโ€ environment
1:39:50 PM: success compile gatsby files - 1.122s
1:39:50 PM: success load gatsby config - 0.021s
1:39:50 PM: verbose 2.471179117 Reusing existing adapter gatsby-adapter-netlify inside node_modules
1:39:50 PM: info Using gatsby-adapter-netlify adapter
1:39:50 PM: verbose 2.479432201 [gatsby-adapter-netlify] version: 1.0.4
1:39:50 PM: verbose 2.50096069 [gatsby-adapter-netlify] using @netlify/cache-utils restore
1:39:50 PM: success load plugins - 0.146s
1:39:50 PM: success onPreInit - 0.002s
1:39:50 PM: success initialize cache - 0.038s
1:39:50 PM: success copy gatsby files - 0.061s
1:39:51 PM: success Compiling Gatsby Functions - 0.146s
1:39:51 PM: success onPreBootstrap - 0.154s
1:39:51 PM: verbose 2.914590682 Creating 15 worker
1:39:51 PM: success createSchemaCustomization - 0.000s
1:39:51 PM: verbose 3.187798345 Last fetched date: 0
1:39:51 PM: verbose 3.187929708 Current fetch date: 1703075991298
1:39:51 PM: success gatsby-plugin-react-i18next: create node: fr/common - 0.088s
1:39:51 PM: success gatsby-plugin-react-i18next: create node: nl/common - 0.090s
1:40:02 PM: verbose 13.954983827 Association incremental build response code: OK
1:40:02 PM: verbose 14.743545313 Associations to add/update: 8811
1:40:02 PM: verbose 14.743669441 Associations to delete: 464
1:40:05 PM: verbose 17.397041431 Checking for deleted pages
1:40:05 PM: verbose 17.397337699 Deleted 0 pages
1:40:05 PM: verbose 17.397407381 Found 0 changed pages
1:40:05 PM: success Checking for changed pages - 0.000s
1:40:05 PM: success source and transform nodes - 14.431s
1:40:05 PM: info Writing GraphQL type definitions to /opt/build/repo/.cache/schema.gql
1:40:05 PM: success building schema - 0.213s
1:40:20 PM: success createPages - 14.667s
1:40:20 PM: success createPagesStatefully - 0.110s
1:40:20 PM: info Total nodes: 8859, SitePage nodes: 17631 (use --verbose for breakdown)
1:40:20 PM: verbose 32.390107356 Number of node types: 9. Nodes per type: Association: 8811, Directory: 3, File: 2, Locale: 2, PromotedShopNl: 3, ShopNl: 12, Site: 1, SiteBuildMetadata: 1, SitePlugin: 24
1:40:20 PM: verbose 32.390208973 Checking for deleted pages
1:40:20 PM: verbose 32.393593021 Deleted 0 pages
1:40:20 PM: verbose 32.396024935 Found 17631 changed pages
1:40:20 PM: success Checking for changed pages - 0.002s
1:40:20 PM: success onPreExtractQueries - 0.000s
1:40:20 PM: success extract queries from components - 0.212s
1:40:20 PM: success write out redirect data - 0.007s
1:40:20 PM: success onPostBootstrap - 0.000s
1:40:20 PM: info bootstrap finished - 32.676s
1:40:20 PM: success write out requires - 0.084s
1:40:21 PM: warning isModuleDeclaration has been deprecated, please migrate to isImportOrExportDeclaration
1:40:21 PM: at isModuleDeclaration (/opt/build/repo/node_modules/@babel/types/lib/validators/generated/index.js:2748:35)
1:40:21 PM: at PluginPass.Program (/opt/build/repo/node_modules/babel-plugin-lodash/lib/index.js:102:44)
1:40:25 PM: success Building production JavaScript and CSS bundles - 4.287s
1:40:30 PM: success Building HTML renderer - 5.198s
1:40:30 PM: success Execute page configs - 0.040s
1:40:30 PM: success Caching Webpack compilations - 0.112s
1:40:32 PM: success run queries in workers - 2.240s - 17633/17633 7873.60/s
1:40:32 PM: success Merge worker state - 0.024s
1:40:32 PM: success Rewriting compilation hashes - 0.001s
1:40:44 PM: success Writing page-data.json and slice-data.json files to public directory - 11.609s - 17631/17631 1518.69/s
1:41:01 PM: success Building static HTML for pages - 17.032s - 17631/17631 1035.16/s
1:41:01 PM: info There are no new or changed slice html files to build.
1:41:03 PM: success stitching slices - 1.423s
1:41:03 PM: success onPostBuild - 0.000s
1:41:04 PM:
1:41:04 PM: Pages
1:41:04 PM: โ”Œ src/templates/association/association2.tsx
1:41:04 PM: โ”‚ โ”œ /nl/xxxxxxxx/xxxxxxxxxxxxx/
1:41:04 PM: โ”‚ โ”” โ€ฆ17621 more pages available
1:41:04 PM: โ”œ src/pages/404.tsx
1:41:04 PM: โ”‚ โ”œ /404/
1:41:04 PM: โ”‚ โ”” โ€ฆ5 more pages available
1:41:04 PM: โ”” src/pages/index.tsx
1:41:04 PM: โ”œ /
1:41:04 PM: โ”” โ€ฆ2 more pages available
1:41:04 PM: โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
1:41:04 PM: โ”‚ โ”‚
1:41:04 PM: โ”‚ (SSG) Generated at build time โ”‚
1:41:04 PM: โ”‚ D (DSG) Deferred static generation - page generated at runtime โ”‚
1:41:04 PM: โ”‚ โˆž (SSR) Server-side renders at runtime (uses getServerData) โ”‚
1:41:04 PM: โ”‚ ฮป (Function) Gatsby function โ”‚
1:41:04 PM: โ”‚ โ”‚
1:41:04 PM: โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
1:41:04 PM: info Done building in 76.171738811 sec
1:41:04 PM: verbose 76.172371993 [gatsby-adapter-netlify] using @netlify/cache-utils save
1:41:10 PM: info [gatsby-adapter-netlify] Stored the Gatsby cache to speed up future builds. :fire:
1:58:04 PM: Failed during stage โ€œbuilding siteโ€: Command did not finish within the time limit
1:58:04 PM: Execution timed out after 18m20.000400593s
1:58:04 PM: Failing build: Failed to build site
1:58:04 PM: Finished processing build request in 18m59.196s

Hi @cris_c,

Thanks for reaching out!

Iโ€™ve increased the build timelimit to 30 minutes for the site. Looks like you were able to resolve the issue as Iโ€™m showing your latest build (before the timelimit increase) was successful.

Hi @Melvin, thanks for your quick response and increasing build timelimit.
The build started to work because I changed SSG into DSG as a workaround but would be great to not use DSG.

Can you explain what is being perfomed after โ€˜done buildingโ€™ message from gatsby to better understand what we can do to improve it?

Hi, @cris_c. That is still in the build command section of the code. In most cases the root cause is that there is a background process that is still running or is in a โ€œzombie processโ€ state.

In situations like this, the solution is to make certain to close any external database connections and to completely stop any child processes.

Hi Netlify team,

I work on the same team as OP. We still have this issue.
I made a minimal reproducible example with site ID fc1f1765-49b0-4652-a287-45e385af8ffa.

Everything there is to disable in the project is disabled: no plugins, no calls, no nodes, no netlify.toml, nothing. The only thing it does is make 20K super small pages using a for loop.

I tried with the Gatsby adapter, without it, with all kinds of environment variables etc. etc.
Nothing works.

Building locally works fine, in a minute or so. Building 10K instead of 20K pages also works fine.
Is it even possible to build 20K (tiny) pages? Can I disable saving the cache to try if that helps?

Could you please take a look at the example and check what is wrong?
We havenโ€™t got a clue anymore what to try.

Cheers,
Lukas

This appears to be going on in the helpdesk ask well. We will continue there.