Skip to content

connection_pool gem incompatibility #343

@panterch

Description

@panterch

Yes, react-rails 3.2.1 has a known incompatibility with connection_pool ~> 3.0 (default in Bundler/Rails 8+), causing runtime errors during asset compilation/server start due to API changes in ConnectionPool#with block handling.[1]

Root Cause

  • react-rails internally uses ConnectionPool for asset precompilation (Webpack/ESBuild workers).
  • connection_pool 3.x changed with signature (fiber/thread safety); react-rails 3.2.1 calls it incorrectly.[2]

Quick Fixes

1. Pin Compatible ConnectionPool (Immediate)

Add to Gemfile:

gem 'connection_pool', '~> 2.4'
bundle update connection_pool

Compatible with react-rails 3.2.1; no code changes. Restart server/assets.[1]

2. Upgrade react-rails (Recommended)

# Gemfile
gem 'react-rails', github: 'reactjs/react-rails'  # Latest ~3.3.x
# or wait for 3.3.0 stable
bundle update react-rails

Newer versions fix connection_pool 3.x support. Check changelog.[3]

3. Remove react-rails (Modern Alternative)

Rails 7+ uses jsbundling-rails + shakapacker (esbuild/vite/webpack) for React—no react-rails needed:

# Gemfile
gem 'jsbundling-rails'
gem 'shakapacker'  # Webpack for React

# Remove: gem 'react-rails'
rails jsbundling:esbuild  # or vite
rails shakapacker:install:webpack

Register components manually via import—cleaner, faster.[3]

Verify Resolution

bundle exec rails s  # No connection_pool errors
RAILS_ENV=production bundle exec rails assets:precompile

Pin 2.4 first (safest), upgrade later. Your Devise/STI tests unrelated—this is asset pipeline only.[1]

1
2
3
4
5
6
7
8
9
10
11
12
13
14

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions