Skip to content

PG::SyntaxError: ERROR: Error decoding result: failed to decode Protobuf message #337

@mhenrixon

Description

@mhenrixon

I originally posted this to ankane/pghero#527 but after going through the code I only had one reference to google-protobuf and that was from pg_query.

PgHero.databases[:primary].sequences

(wm):12:in '<main>': PG::SyntaxError: ERROR:  Error decoding result: failed to decode Protobuf message: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: Node.node: RawStmt.stmt: ParseResult.stmts: recursion limit reached (ActiveRecord::StatementInvalid)
/usr/local/bundle/ruby/3.4.0/gems/activerecord-8.0.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:160:in 'PG::Connection#exec': ERROR:  Error decoding result: failed to decode Protobuf message: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: SelectStmt.larg: Node.node: RawStmt.stmt: ParseResult.stmts: recursion limit reached (PG::SyntaxError)
	from /usr/local/bundle/ruby/3.4.0/gems/activerecord-8.0.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:160:in 'ActiveRecord::ConnectionAdapters::PostgreSQL::DatabaseStatements#perform_query'
	from /usr/local/bundle/ruby/3.4.0/gems/activerecord-8.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:556:in 'block (2 levels) in ActiveRecord::ConnectionAdapters::DatabaseStatements#raw_execute'
	from /usr/local/bundle/ruby/3.4.0/gems/activerecord-8.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:1015:in 'block in ActiveRecord::ConnectionAdapters::AbstractAdapter#with_raw_connection'
	from /usr/local/bundle/ruby/3.4.0/gems/activesupport-8.0.2/lib/active_support/concurrency/null_lock.rb:9:in 'ActiveSupport::Concurrency::NullLock#synchronize'
	from /usr/local/bundle/ruby/3.4.0/gems/activerecord-8.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:984:in 'ActiveRecord::ConnectionAdapters::AbstractAdapter#with_raw_connection'
	from /usr/local/bundle/ruby/3.4.0/gems/activerecord-8.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:555:in 'block in ActiveRecord::ConnectionAdapters::DatabaseStatements#raw_execute'
	from /usr/local/bundle/ruby/3.4.0/gems/activesupport-8.0.2/lib/active_support/notifications/instrumenter.rb:58:in 'ActiveSupport::Notifications::Instrumenter#instrument'
	from /usr/local/bundle/ruby/3.4.0/gems/activerecord-8.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:1135:in 'ActiveRecord::ConnectionAdapters::AbstractAdapter#log'
	from /usr/local/bundle/ruby/3.4.0/gems/activerecord-8.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:554:in 'ActiveRecord::ConnectionAdapters::DatabaseStatements#raw_execute'
	from /usr/local/bundle/ruby/3.4.0/gems/activerecord-8.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:591:in 'ActiveRecord::ConnectionAdapters::DatabaseStatements#internal_execute'
	from /usr/local/bundle/ruby/3.4.0/gems/activerecord-8.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:547:in 'ActiveRecord::ConnectionAdapters::DatabaseStatements#internal_exec_query'
	from /usr/local/bundle/ruby/3.4.0/gems/activerecord-8.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:693:in 'ActiveRecord::ConnectionAdapters::DatabaseStatements#select'
	from /usr/local/bundle/ruby/3.4.0/gems/activerecord-8.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:73:in 'ActiveRecord::ConnectionAdapters::DatabaseStatements#select_all'
	from /usr/local/bundle/ruby/3.4.0/gems/activerecord-8.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:251:in 'ActiveRecord::ConnectionAdapters::QueryCache#select_all'
	from /usr/local/bundle/ruby/3.4.0/gems/pghero-3.7.0/lib/pghero/methods/basic.rb:49:in 'PgHero::Methods::Basic#select_all_leased'
	from /usr/local/bundle/ruby/3.4.0/gems/pghero-3.7.0/lib/pghero/methods/basic.rb:41:in 'block in PgHero::Methods::Basic#select_all'
	... 39 levels...

For some queries, pghero crashes with this error message. The one I looked into was sequences, but it seems that removing sequence handling on staging didn't help in production, so I am guessing it's something different.

All and any help debugging this would be greatly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions