Code Monkey home page Code Monkey logo

Comments (9)

byroot avatar byroot commented on September 26, 2024 1

Please at least include the full backtraces.

from rails.

nathan-appere avatar nathan-appere commented on September 26, 2024 1

@trevorturk I'm not using Falcon or Fibers 🤔

from rails.

nathan-appere avatar nathan-appere commented on September 26, 2024

Possibly related: #48716

from rails.

nathan-appere avatar nathan-appere commented on September 26, 2024
NoMethodError
undefined method `cmd_tuples' for []:Array (NoMethodError)
          execute_and_clear(sql, name, binds) { |result| result.cmd_tuples }

activerecord (7.1.3.2) lib/active_record/connection_adapters/postgresql/database_statements.rb in block in exec_delete
activerecord (7.1.3.2) lib/active_record/connection_adapters/postgresql_adapter.rb in execute_and_clear at line 877
activerecord (7.1.3.2) lib/active_record/connection_adapters/postgresql/database_statements.rb in exec_delete at line 77
activerecord (7.1.3.2) lib/active_record/connection_adapters/abstract/database_statements.rb in delete at line 208
activerecord (7.1.3.2) lib/active_record/connection_adapters/abstract/query_cache.rb in delete at line 25
activerecord (7.1.3.2) lib/active_record/persistence.rb in _delete_record at line 624
activerecord (7.1.3.2) lib/active_record/persistence.rb in _delete_row at line 1198
activerecord (7.1.3.2) lib/active_record/persistence.rb in destroy_row at line 1194
activerecord (7.1.3.2) lib/active_record/counter_cache.rb in destroy_row at line 197
activerecord (7.1.3.2) lib/active_record/locking/optimistic.rb in destroy_row at line 125
activerecord (7.1.3.2) lib/active_record/persistence.rb in destroy at line 783
activerecord (7.1.3.2) lib/active_record/callbacks.rb in block in destroy at line 423
activesupport (7.1.3.2) lib/active_support/callbacks.rb in run_callbacks at line 110
activesupport (7.1.3.2) lib/active_support/callbacks.rb in _run_destroy_callbacks at line 952
activerecord (7.1.3.2) lib/active_record/callbacks.rb in destroy at line 423
activerecord (7.1.3.2) lib/active_record/transactions.rb in block in destroy at line 305
activerecord (7.1.3.2) lib/active_record/transactions.rb in block in with_transaction_returning_status at line 365
activerecord (7.1.3.2) lib/active_record/connection_adapters/abstract/transaction.rb in block in within_new_transaction at line 535
activesupport (7.1.3.2) lib/active_support/concurrency/null_lock.rb in synchronize at line 9
activerecord (7.1.3.2) lib/active_record/connection_adapters/abstract/transaction.rb in within_new_transaction at line 532
activerecord (7.1.3.2) lib/active_record/connection_adapters/abstract/database_statements.rb in transaction at line 344
activerecord (7.1.3.2) lib/active_record/transactions.rb in with_transaction_returning_status at line 361
activerecord (7.1.3.2) lib/active_record/transactions.rb in destroy at line 305

and

NoMethodError
undefined method `clear' for nil:NilClass (NoMethodError)
            result.clear

activerecord (7.1.3.2) lib/active_record/connection_adapters/postgresql_adapter.rb in execute_and_clear at line 879
activerecord (7.1.3.2) lib/active_record/connection_adapters/postgresql/database_statements.rb in exec_delete at line 77
activerecord (7.1.3.2) lib/active_record/connection_adapters/abstract/database_statements.rb in delete at line 208
activerecord (7.1.3.2) lib/active_record/connection_adapters/abstract/query_cache.rb in delete at line 25
activerecord (7.1.3.2) lib/active_record/persistence.rb in _delete_record at line 624
activerecord (7.1.3.2) lib/active_record/persistence.rb in _delete_row at line 1198
activerecord (7.1.3.2) lib/active_record/persistence.rb in destroy_row at line 1194
activerecord (7.1.3.2) lib/active_record/counter_cache.rb in destroy_row at line 197
activerecord (7.1.3.2) lib/active_record/locking/optimistic.rb in destroy_row at line 125
activerecord (7.1.3.2) lib/active_record/persistence.rb in destroy at line 783
activerecord (7.1.3.2) lib/active_record/callbacks.rb in block in destroy at line 423
activesupport (7.1.3.2) lib/active_support/callbacks.rb in run_callbacks at line 110
activesupport (7.1.3.2) lib/active_support/callbacks.rb in _run_destroy_callbacks at line 952
activerecord (7.1.3.2) lib/active_record/callbacks.rb in destroy at line 423
activerecord (7.1.3.2) lib/active_record/transactions.rb in block in destroy at line 305
activerecord (7.1.3.2) lib/active_record/transactions.rb in block in with_transaction_returning_status at line 365
activerecord (7.1.3.2) lib/active_record/connection_adapters/abstract/transaction.rb in block in within_new_transaction at line 535
activesupport (7.1.3.2) lib/active_support/concurrency/null_lock.rb in synchronize at line 9
activerecord (7.1.3.2) lib/active_record/connection_adapters/abstract/transaction.rb in within_new_transaction at line 532
activerecord (7.1.3.2) lib/active_record/connection_adapters/abstract/database_statements.rb in transaction at line 344
activerecord (7.1.3.2) lib/active_record/transactions.rb in with_transaction_returning_status at line 361
activerecord (7.1.3.2) lib/active_record/transactions.rb in destroy at line 305

from rails.

casperisfine avatar casperisfine commented on September 26, 2024

result.clear at https://github.com/rails/rails/blob/v7.1.3.2/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb#L879

          if !prepare || without_prepared_statement?(binds)
            result = exec_no_cache(sql, name, binds, async: async, allow_retry: allow_retry, materialize_transactions: materialize_transactions)
          else
            result = exec_cache(sql, name, binds, async: async, allow_retry: allow_retry, materialize_transactions: materialize_transactions)
          end
          begin
            ret = yield result
          ensure
            result.clear
          end
          ret

This suggest exec_cache or exec_no_cache returned nil, which shouldn't happen.

from rails.

casperisfine avatar casperisfine commented on September 26, 2024

it only happens in our production environment

Any patterns on how it happen? e.g. fully random? Or some spikes around a certain time across all processes, or only in one process, etc?

from rails.

nathan-appere avatar nathan-appere commented on September 26, 2024

@casperisfine figured it out, this was somehow caused by a missing dependent: :destroy on a model, no idea how that materialized as nil result though 🤔

from rails.

byroot avatar byroot commented on September 26, 2024

Yeah, that's extremely weird. If you ever come up with a repro, please share it. Because I suspect there is more to it.

from rails.

trevorturk avatar trevorturk commented on September 26, 2024

I'm not sure if this is related, but I wanted to mention that I encountered the same result.clear error where exec_cache and exec_no_cache (I tested both) were nil (which shouldn't happen) when I upgraded from Rails 7.0.x to 7.1.x in an app running Falcon where I hadn't switched isolation_state to :fiber. Once I switched the isolation state to fiber, the error disappeared. (There were a few other strange errors like this which all disappeared, but this was the most common one by far, and not just triggered by deleting records.)

I'm curious if @nathan-appere might be using Falcon and/or Fibers? I'm sorry if this isn't related or is misdirecting from the actual issue, but I thought it worth mentioning. Thanks!

from rails.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.