Skip to content

Fix rails72 multibuildpack staging timeout by removing unused webpacker/sass-rails - #1182

Open
ivanovac wants to merge 3 commits into
masterfrom
fix-rails72-staging-timeout
Open

ivanovac wants to merge 3 commits into
masterfrom
fix-rails72-staging-timeout

Conversation

@ivanovac

Copy link
Copy Markdown
Contributor

Problem

Builds #19-28 fail with CF's hard 15-minute staging timeout. The root cause is not webpack compilation time (which only takes ~1m12s) — it is cumulative staging time exceeding 15 minutes:

Step Time
Go binary compilation (supply) ~3 min
Python bootstrap + Node install ~25s
yarn install ~32s
bundle install (78 gems, includes sassc native C extension) ~9 min
Asset precompilation (webpack) ~1m12s
Total ~15-16 min → timeout

Previous PRs (#1178, #1179, #1180) addressed symptoms (test timeouts, app start timeout, manifest variable substitution) but not this root cause. PR #1181's fake manifest approach would save ~1m12s but the remaining ~14min still exceeds the limit.

Solution

The test only asserts two things:

Ruby version: ruby 3.x.x
Node version: vX.X.X

The controller just runs ruby -v and node -v. It does not use webpacker, sass-rails, webpack, SCSS, or the asset pipeline in any way. Remove those gems and everything they pull in.

Changes

  • Gemfile: drop webpacker and sass-rails (only 2 gems declared now: rails + puma)
  • Gemfile.lock: regenerated — 68 gems down from 78; sassc, ffi, webpacker, sprockets, nokogiri and ~10 others removed
  • config/application.rb: drop sprockets/railtie require
  • config/environments/production.rb: drop asset pipeline config blocks
  • Deleted: package.json, yarn.lock, babel.config.js, postcss.config.js, app/javascript/, app/assets/, bin/webpack, bin/webpack-dev-server, bin/yarn
  • .gitignore: drop node/yarn entries

Expected result

Step Before After
bundle install ~9 min (78 gems, sassc native) ~3-4 min (~68 gems, no native C)
Asset precompilation ~1m12s skipped entirely (no sprockets/webpacker)
Total staging ~15-16 min (timeout) ~8-10 min ✅

Related PRs

… staging timeout

The rails72 fixture was hitting CF's 15-minute staging hard limit because
bundle install alone took ~9 minutes (78 gems including sassc native extension
and webpacker). Asset precompilation added another ~1m12s on top, pushing
total staging to 15-16 minutes.

The test only asserts Ruby and Node version strings from `ruby -v` / `node -v`.
It does not exercise the asset pipeline, webpack, or SCSS. Remove webpacker
and sass-rails (and all their transitive dependencies) from the Gemfile since
they are unused by the controller and test assertions.

Changes:
- Gemfile: drop webpacker and sass-rails gems
- Gemfile.lock: regenerated (68 gems, down from 78; sassc/ffi/webpacker removed)
- config/application.rb: drop sprockets/railtie require
- config/environments/production.rb: drop asset pipeline config
- Delete package.json, yarn.lock, babel.config.js, postcss.config.js
- Delete app/javascript/, app/assets/, bin/webpack, bin/webpack-dev-server, bin/yarn
- .gitignore: drop node/yarn entries

Staging time should drop from ~15-16 min to ~8-10 min, well within CF's limit.
@tnikolova82

Copy link
Copy Markdown
Contributor

❌ PR Fails Integration Tests - Root Cause Identified

This PR breaks the nodejs multibuildpack test because it deletes entirely.

Test Failure Evidence

From the failed integration test run:

=== NAME  TestIntegration/integration/MultiBuildpack/when_supplied_with_nodejs/finds_the_supplied_dependency_in_the_runtime_container
    Timed out after 90.001s.
    Get "http://localhost:32781": dial tcp [::1]:32781: connect: connection refused

Why It Fails

The multibuildpack test uses nodejs-buildpack + ruby-buildpack together:

  1. nodejs-buildpack detection: Looks for package.json to know it should install node
  2. This PR deletes package.json → nodejs-buildpack doesn't install node
  3. Without node: The app controller can't respond to node -v command
  4. Result: App never starts, test times out

The Analysis Is Partially Correct

You're right that the root bottleneck is bundle install time (~9 min with 78 gems including sassc native extensions), not asset precompilation (~1m12s). Removing webpacker/sass-rails would help.

BUT you also removed the Node.js dependencies, which breaks the test's actual purpose.

What The Test Actually Needs

# The test ONLY checks these two things:
Eventually(deployment).Should(Serve(ContainSubstring("Ruby version: ruby 3.")))
Eventually(deployment).Should(Serve(MatchRegexp(`Node version: v\d+\.\d+\.\d+`)))

The app controller runs:

node_version = `node -v`  # ← NEEDS node to be installed
ruby_version = `ruby -v`

Correct Solution

Hybrid approach - keep what's needed, remove what's not:

File Current This PR Should Be
package.json Full webpacker deps ❌ Deleted ✅ Minimal: {"name":"app","private":true}
yarn.lock Full lockfile ❌ Deleted ✅ Keep (or regenerate minimal)
Gemfile Has webpacker/sass-rails ❌ Deleted ✅ Remove webpacker/sass-rails
Gemfile.lock 78 gems ❌ Deleted ✅ Regenerate (~68 gems)

Expected Staging Time

Phase Current Master (PR #1181) This PR (Broken) Correct Fix
Go compilation ~3 min ~3 min ~3 min
Node/Python setup ~25s ❌ Skipped ~25s
yarn install ~32s ❌ Skipped ~5s (no deps)
bundle install ~9 min (78 gems, native) ❌ Fails ~3-4 min (68 gems, no native)
Asset precompile ✅ Skipped (PR #1181 fake manifest) N/A ✅ Skipped
Total ~13-14 min (risky) ❌ Test fails ✅ ~8 min (safe)

Recommendation

Close this PR and create a new one that:

  1. ✅ Keeps minimal package.json for nodejs-buildpack detection
  2. ✅ Removes webpacker/sass-rails from Gemfile
  3. ✅ Regenerates Gemfile.lock with fewer gems
  4. ✅ Keeps PR Skip asset precompilation in rails72 multibuildpack test to avoid CF staging timeout #1181's fake sprockets manifest

This gives us the bundle install speedup you identified without breaking the nodejs multibuildpack detection.

Current Status

PR #1181 is already merged and includes the fake sprockets manifest that skips asset precompilation. It might be sufficient if build #28 passes. If build #28 shows staging is still too close to the 15min limit, then we should implement the hybrid fix above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants