Skip to content

Error payload string too long with ActiveJob and Postgres 16 #60

@czj

Description

@czj

If I recall correctly, Postgres with ActionCable cannot handle more than 8 kb of payload.

We get this error in our app, whether we run use mode: :poll or not, wether we include the ERP helpers in head/body.

Our stack is pretty simple, with a very large monolith app:

  • Rails 8.0.2
  • Puma 6.6.0
  • Ruby 3.4.2
  • Postgres 16
  • ActionCable (use a lot in our app)
Puma caught this error: ERROR:  payload string too long
 (PG::InvalidParameterValue)
.../actioncable-8.0.2/lib/action_cable/subscription_adapter/postgresql.rb:21:in 'PG::Connection#exec'
.../actioncable-8.0.2/lib/action_cable/subscription_adapter/postgresql.rb:21:in 'block in ActionCable::SubscriptionAdapter::PostgreSQL#broadcast'
.../actioncable-8.0.2/lib/action_cable/subscription_adapter/postgresql.rb:55:in 'block in ActionCable::SubscriptionAdapter::PostgreSQL#with_broadcast_connection'
.../activerecord-8.0.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:418:in 'ActiveRecord::ConnectionAdapters::ConnectionPool#with_connection'
.../actioncable-8.0.2/lib/action_cable/subscription_adapter/postgresql.rb:52:in 'ActionCable::SubscriptionAdapter::PostgreSQL#with_broadcast_connection'
.../actioncable-8.0.2/lib/action_cable/subscription_adapter/postgresql.rb:20:in 'ActionCable::SubscriptionAdapter::PostgreSQL#broadcast'
.../actioncable-8.0.2/lib/action_cable/subscription_adapter/channel_prefix.rb:10:in 'ActionCable::SubscriptionAdapter::ChannelPrefix#broadcast'
.../actioncable-8.0.2/lib/action_cable/server/broadcasting.rb:56:in 'block in ActionCable::Server::Broadcasting::Broadcaster#broadcast'
.../activesupport-8.0.2/lib/active_support/notifications.rb:210:in 'block in ActiveSupport::Notifications.instrument'
.../activesupport-8.0.2/lib/active_support/notifications/instrumenter.rb:58:in 'ActiveSupport::Notifications::Instrumenter#instrument'
.../activesupport-8.0.2/lib/active_support/notifications.rb:210:in 'ActiveSupport::Notifications.instrument'
.../actioncable-8.0.2/lib/action_cable/server/broadcasting.rb:54:in 'ActionCable::Server::Broadcasting::Broadcaster#broadcast'
.../actioncable-8.0.2/lib/action_cable/server/broadcasting.rb:32:in 'ActionCable::Server::Broadcasting#broadcast'
.../debugbar-0.4.3/lib/debugbar/middlewares/track_current_request.rb:29:in 'Debugbar::TrackCurrentRequest#call'
.../actionpack-8.0.2/lib/action_dispatch/middleware/executor.rb:16:in 'ActionDispatch::Executor#call'
.../actionpack-8.0.2/lib/action_dispatch/middleware/static.rb:27:in 'ActionDispatch::Static#call'
.../rack-3.1.12/lib/rack/sendfile.rb:114:in 'Rack::Sendfile#call'
.../actionpack-8.0.2/lib/action_dispatch/middleware/host_authorization.rb:143:in 'ActionDispatch::HostAuthorization#call'
.../rack-3.1.12/lib/rack/events.rb:116:in 'Rack::Events#call'
.../railties-8.0.2/lib/rails/engine.rb:535:in 'Rails::Engine#call'
.../puma-6.6.0/lib/puma/configuration.rb:279:in 'Puma::Configuration::ConfigMiddleware#call'
.../puma-6.6.0/lib/puma/request.rb:99:in 'block in Puma::Request#handle_request'
.../puma-6.6.0/lib/puma/thread_pool.rb:390:in 'Puma::ThreadPool#with_force_shutdown'
.../puma-6.6.0/lib/puma/request.rb:98:in 'Puma::Request#handle_request'
.../puma-6.6.0/lib/puma/server.rb:472:in 'Puma::Server#process_client'
.../puma-6.6.0/lib/puma/server.rb:254:in 'block in Puma::Server#run'
.../puma-6.6.0/lib/puma/thread_pool.rb:167:in 'block in Puma::ThreadPool#spawn_thread'

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