brendon / ranked-model

An acts_as_sortable/acts_as_list replacement built for Rails 4+

Home Page:https://github.com/mixonic/ranked-model

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

undefined method `rank' for nil:NilClass

ombr opened this issue · comments

Sometimes in production (on heroku, rails 5.0.3) I get this error:

undefined method `rank' for nil:NilClass

Here is the stack trace:

/app/vendor/bundle/ruby/2.3.0/gems/ranked-model-0.4.0/lib/ranked-model/ranker.rb:177:in `rearrange_ranks'
/app/vendor/bundle/ruby/2.3.0/gems/ranked-model-0.4.0/lib/ranked-model/ranker.rb:166:in `assure_unique_position'
/app/vendor/bundle/ruby/2.3.0/gems/ranked-model-0.4.0/lib/ranked-model/ranker.rb:61:in `handle_ranking'
/app/vendor/bundle/ruby/2.3.0/gems/ranked-model-0.4.0/lib/ranked-model.rb:31:in `block in handle_ranking'
/app/vendor/bundle/ruby/2.3.0/gems/ranked-model-0.4.0/lib/ranked-model.rb:30:in `each'
/app/vendor/bundle/ruby/2.3.0/gems/ranked-model-0.4.0/lib/ranked-model.rb:30:in `handle_ranking'
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:382:in `block in make_lambda'
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:169:in `block (2 levels) in halting'
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:770:in `block (2 levels) in deprecated_false_terminator'
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:769:in `catch'
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:769:in `block in deprecated_false_terminator'
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:170:in `block in halting'
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:454:in `block in call'
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:454:in `each'
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:454:in `call'
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:101:in `__run_callbacks__'
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:750:in `_run_save_callbacks'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.3/lib/active_record/callbacks.rb:298:in `create_or_update'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.3/lib/active_record/persistence.rb:160:in `save!'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.3/lib/active_record/validations.rb:50:in `save!'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.3/lib/active_record/attribute_methods/dirty.rb:30:in `save!'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.3/lib/active_record/transactions.rb:324:in `block in save!'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.3/lib/active_record/transactions.rb:395:in `block in with_transaction_returning_status'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.3/lib/active_record/connection_adapters/abstract/database_statements.rb:232:in `block in transaction'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.3/lib/active_record/connection_adapters/abstract/transaction.rb:189:in `within_new_transaction'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.3/lib/active_record/connection_adapters/abstract/database_statements.rb:232:in `transaction'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.3/lib/active_record/transactions.rb:211:in `transaction'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.3/lib/active_record/transactions.rb:392:in `with_transaction_returning_status'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.3/lib/active_record/transactions.rb:324:in `save!'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.3/lib/active_record/suppressor.rb:45:in `save!'

What can I do ? It might be a concurency issue, because it only happen when loading a lot of items concurently.

Thanks in advance for your help.

I have been having this issue too when uploading a lot of files at once. The files lead to creation of ranked models.

I think it's a concurrency issue. If you'd like to look at some locking solutions I'd be happy to help get those merged. Perhaps take a look at the advisory_lock gem?

I feel like this one was fixed but perhaps I didn't close these issues and PR's? From memory the fix was to check for the existence before attempting to call methods on the object. Or are you still experiencing this issue?

@brendon I actually don't know if we're still experiencing it because we're running my handle_missing_records from #148 I was looking at our Gemfile and saw we were still on my fork so thought to come back and see what was new in the repo and found this issue which seemed related to mine, so I linked them.

But, I don't think the missing object was ever handled in this codebase. I'm up for collaborating on some PRs if you are, but at this point, it's really about deciding on handling it since we never really figured out how the object came to be nil.

Definitely keen to help fix it if we can figure out the cause. There was a situation with rebalancing where I did add a check for nil? from memory. I'm not sure if this was related. Perhaps update your fork against master and see if there's anything like that that was added?

I'm just going to close my issues and hope for the best

Thanks @bf4. Always happy to help on this in the future. Key will be having a clear failing test :)

To be fair, 1) I wrote a failing test and provided a number of possible ways to address it; I just never reproduced the bug on demand. 2) I suggested some other improvements which were also not considered (like always call super in an inherited method)

My apologies for missing your other commit. I think I noticed that it failed to test out green so I was originally thinking you'd fix that before I took a look. I've done a review of that with some comments.

Regarding the failing test, am I right in that you're forcing a fail by calling a method that wouldn't normally be called on a sparse list? current_first Unfortunately we need more than this. We need to be able to cause the bug reliably, as that will help come up with a quality solution to the problem.

Key will be figuring out why this code calls rearrange_ranks on an empty list:

      def assure_unique_position
        if ( new_record? || rank_changed? )
          if (rank > RankedModel::MAX_RANK_VALUE) || rank_taken?
            rearrange_ranks
          end
        end
      end

At the end of the day I'm maintaining this library on a voluntary basis and don't have the time to narrow this one down further, but I'm always happy to assist you where I can.

At the end of the day I'm maintaining this library on a voluntary basis and don't have the time to narrow this one down further, but I'm always happy to assist you where I can.

Totally feel that. Fellow (burned out) maintainer here

Ignore.., missed this (breaking to me) change #167 (comment)

FWIW, got an error again on 0.4.6 against Rails 6.0 on Ruby 2.7.2

I had been running off of my handle_missing_records fork pegged at 0.4.4 since July 2019 without issue till I removed it for 0.4.6 on December 31.

I'm not sure what information would be helpful were I to fork the gem again to protect against this issue. I see #117 is still open

ActiveRecord::NotNullViolation:
PG::NotNullViolation: ERROR:  null value in column "sequence" violates not-null constraint
DETAIL:  Failing row contains (40062, 48012, null, null, 75, 40, 2037, null, 0, 2021-01-12 21:39:06.820401, 2021-01-12 21:39:06.820401, 21, null, null, 0, null, 9416, t, null, null, null, f).

gem-related trace

(Most recent call first)
File /app/vendor/bundle/ruby/2.7.0/gems/ranked-model-0.4.6/lib/ranked-model/ranker.rb line 216 in rebalance_ranks
File /app/vendor/bundle/ruby/2.7.0/gems/ranked-model-0.4.6/lib/ranked-model/ranker.rb line 211 in rearrange_ranks
File /app/vendor/bundle/ruby/2.7.0/gems/ranked-model-0.4.6/lib/ranked-model/ranker.rb line 183 in assure_unique_position
File /app/vendor/bundle/ruby/2.7.0/gems/ranked-model-0.4.6/lib/ranked-model/ranker.rb line 61 in handle_ranking
File /app/vendor/bundle/ruby/2.7.0/gems/ranked-model-0.4.6/lib/ranked-model.rb line 33 in block in handle_ranking
File /app/vendor/bundle/ruby/2.7.0/gems/ranked-model-0.4.6/lib/ranked-model.rb line 32 in each
File /app/vendor/bundle/ruby/2.7.0/gems/ranked-model-0.4.6/lib/ranked-model.rb line 32 in handle_ranking
File /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb line 428 in block in make_lambda

the specific query I see was upon PATCH id 40061

/*controller_with_namespace:V1::JobProductionPlanSegmentsController,action:update*/ 
UPDATE "job_production_plan_segments" 
SET "sequence" = $1 
WHERE "job_production_plan_segments"."id" IN (
  SELECT "job_production_plan_segments"."id" 
  FROM "job_production_plan_segments" 
  WHERE "job_production_plan_segments"."job_production_plan_id" = $2 
  AND "job_production_plan_segments"."id" != $3 
  ORDER BY "job_production_plan_segments"."sequence" ASC
)

with binds

  • #<ActiveRecord::Relation::QueryAttribute:0x00007f89560170e8 @name="sequence", @value_before_type_cast=nil, @type=#<ActiveModel::Type::Integer:0x00007f896577d170 @precision=nil, @scale=nil, @limit=4, @range=-2147483648...2147483648>, @original_attribute=nil, @value=nil, @value_for_database=nil>
  • 48012
  • 40061

full trace

(Most recent call first)
File /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql_adapter.rb line 675 in exec_params
File /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql_adapter.rb line 675 in block (2 levels) in exec_no_cache
File /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies/interlock.rb line 48 in block in permit_concurrent_loads
File /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/concurrency/share_lock.rb line 187 in yield_shares
File /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies/interlock.rb line 47 in permit_concurrent_loads
File /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql_adapter.rb line 674 in block in exec_no_cache
File /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract_adapter.rb line 722 in block (2 levels) in log
File /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/concurrency/load_interlock_aware_monitor.rb line 26 in block (2 levels) in synchronize
File /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/concurrency/load_interlock_aware_monitor.rb line 25 in handle_interrupt
File /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/concurrency/load_interlock_aware_monitor.rb line 25 in block in synchronize
File /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/concurrency/load_interlock_aware_monitor.rb line 21 in handle_interrupt
File /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/concurrency/load_interlock_aware_monitor.rb line 21 in synchronize
File /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract_adapter.rb line 721 in block in log
File /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/notifications/instrumenter.rb line 24 in instrument
File /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract_adapter.rb line 712 in log
File /app/vendor/bundle/ruby/2.7.0/gems/scout_apm-4.0.0/lib/scout_apm/instruments/active_record.rb line 264 in log
File /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql_adapter.rb line 673 in exec_no_cache
File /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql_adapter.rb line 656 in execute_and_clear
File /app/vendor/bundle/ruby/2.7.0/gems/marginalia-1.10.0/lib/marginalia.rb line 95 in execute_and_clear_with_marginalia
File /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb line 111 in exec_delete
File /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/database_statements.rb line 174 in update
File /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/query_cache.rb line 22 in update
File /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/relation.rb line 469 in update_all
File /app/vendor/bundle/ruby/2.7.0/gems/ranked-model-0.4.6/lib/ranked-model/ranker.rb line 73 in reset_ranks!
File /app/vendor/bundle/ruby/2.7.0/gems/ranked-model-0.4.6/lib/ranked-model/ranker.rb line 231 in block in rebalance_ranks
File /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/database_statements.rb line 278 in transaction
File /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/transactions.rb line 212 in transaction
File /app/vendor/bundle/ruby/2.7.0/gems/ranked-model-0.4.6/lib/ranked-model/ranker.rb line 216 in rebalance_ranks
File /app/vendor/bundle/ruby/2.7.0/gems/ranked-model-0.4.6/lib/ranked-model/ranker.rb line 211 in rearrange_ranks
File /app/vendor/bundle/ruby/2.7.0/gems/ranked-model-0.4.6/lib/ranked-model/ranker.rb line 183 in assure_unique_position
File /app/vendor/bundle/ruby/2.7.0/gems/ranked-model-0.4.6/lib/ranked-model/ranker.rb line 61 in handle_ranking
File /app/vendor/bundle/ruby/2.7.0/gems/ranked-model-0.4.6/lib/ranked-model.rb line 33 in block in handle_ranking
File /app/vendor/bundle/ruby/2.7.0/gems/ranked-model-0.4.6/lib/ranked-model.rb line 32 in each
File /app/vendor/bundle/ruby/2.7.0/gems/ranked-model-0.4.6/lib/ranked-model.rb line 32 in handle_ranking
File /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb line 428 in block in make_lambda
File /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb line 200 in block (2 levels) in halting
File /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb line 605 in block (2 levels) in default_terminator
File /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb line 604 in catch
File /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb line 604 in block in default_terminator
File /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb line 201 in block in halting
File /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb line 513 in block in invoke_before
File /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb line 513 in each
File /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb line 513 in invoke_before
File /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb line 134 in run_callbacks
File /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb line 825 in _run_save_callbacks
File /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/callbacks.rb line 327 in create_or_update
File /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/timestamp.rb line 128 in create_or_update
File /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/persistence.rb line 470 in save
File /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/validations.rb line 47 in save
File /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/transactions.rb line 314 in block in save
File /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/transactions.rb line 375 in block in with_transaction_returning_status
File /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/database_statements.rb line 278 in transaction
File /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/transactions.rb line 212 in transaction
File /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/transactions.rb line 366 in with_transaction_returning_status
File /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/transactions.rb line 314 in save
File /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/suppressor.rb line 44 in save
File /app/vendor/bundle/ruby/2.7.0/gems/scout_apm-4.0.0/lib/scout_apm/instruments/active_record.rb line 406 in save
File /app/vendor/bundle/ruby/2.7.0/gems/jsonapi-resources-0.9.10/lib/jsonapi/resource.rb line 204 in _save
File /app/vendor/bundle/ruby/2.7.0/gems/jsonapi-resources-0.9.10/lib/jsonapi/resource.rb line 181 in block in save
File /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb line 135 in run_callbacks
File /app/vendor/bundle/ruby/2.7.0/gems/jsonapi-resources-0.9.10/lib/jsonapi/resource.rb line 180 in save
File /app/vendor/bundle/ruby/2.7.0/gems/jsonapi-resources-0.9.10/lib/jsonapi/resource.rb line 61 in block in change
File /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb line 135 in run_callbacks
File /app/vendor/bundle/ruby/2.7.0/gems/jsonapi-resources-0.9.10/lib/jsonapi/resource.rb line 55 in change
File /app/vendor/bundle/ruby/2.7.0/gems/jsonapi-resources-0.9.10/lib/jsonapi/resource.rb line 111 in replace_fields
File /app/vendor/bundle/ruby/2.7.0/gems/jsonapi-resources-0.9.10/lib/jsonapi/processor.rb line 252 in replace_fields
File /app/vendor/bundle/ruby/2.7.0/gems/jsonapi-resources-0.9.10/lib/jsonapi/processor.rb line 58 in block (2 levels) in process
File /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb line 101 in run_callbacks
File /app/vendor/bundle/ruby/2.7.0/gems/jsonapi-resources-0.9.10/lib/jsonapi/processor.rb line 57 in block in process
File /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb line 101 in run_callbacks
File /app/vendor/bundle/ruby/2.7.0/gems/jsonapi-resources-0.9.10/lib/jsonapi/processor.rb line 56 in process
File /app/vendor/bundle/ruby/2.7.0/gems/jsonapi-resources-0.9.10/lib/jsonapi/operation.rb line 16 in process
File /app/vendor/bundle/ruby/2.7.0/gems/jsonapi-resources-0.9.10/lib/jsonapi/operation_dispatcher.rb line 58 in block in process_operation
File /app/vendor/bundle/ruby/2.7.0/gems/jsonapi-resources-0.9.10/lib/jsonapi/operation_dispatcher.rb line 63 in with_default_handling
File /app/vendor/bundle/ruby/2.7.0/gems/jsonapi-resources-0.9.10/lib/jsonapi/operation_dispatcher.rb line 57 in process_operation
File /app/vendor/bundle/ruby/2.7.0/gems/jsonapi-resources-0.9.10/lib/jsonapi/operation_dispatcher.rb line 29 in block (2 levels) in process
File /app/vendor/bundle/ruby/2.7.0/gems/jsonapi-resources-0.9.10/lib/jsonapi/operation_dispatcher.rb line 28 in each
File /app/vendor/bundle/ruby/2.7.0/gems/jsonapi-resources-0.9.10/lib/jsonapi/operation_dispatcher.rb line 28 in block in process
File /app/vendor/bundle/ruby/2.7.0/gems/jsonapi-resources-0.9.10/lib/jsonapi/operation_dispatcher.rb line 43 in block in transaction
File /app/vendor/bundle/ruby/2.7.0/gems/jsonapi-resources-0.9.10/lib/jsonapi/acts_as_resource_controller.rb line 93 in block (2 levels) in transaction
File /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/database_statements.rb line 280 in block in transaction
File /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/transaction.rb line 280 in block in within_new_transaction
File /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/concurrency/load_interlock_aware_monitor.rb line 26 in block (2 levels) in synchronize
File /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/concurrency/load_interlock_aware_monitor.rb line 25 in handle_interrupt
File /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/concurrency/load_interlock_aware_monitor.rb line 25 in block in synchronize
File /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/concurrency/load_interlock_aware_monitor.rb line 21 in handle_interrupt
File /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/concurrency/load_interlock_aware_monitor.rb line 21 in synchronize
File /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/transaction.rb line 278 in within_new_transaction
File /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/database_statements.rb line 280 in transaction
File /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/transactions.rb line 212 in transaction
File /app/vendor/bundle/ruby/2.7.0/gems/jsonapi-resources-0.9.10/lib/jsonapi/acts_as_resource_controller.rb line 92 in block in transaction
File /app/vendor/bundle/ruby/2.7.0/gems/jsonapi-resources-0.9.10/lib/jsonapi/operation_dispatcher.rb line 42 in transaction
File /app/vendor/bundle/ruby/2.7.0/gems/jsonapi-resources-0.9.10/lib/jsonapi/operation_dispatcher.rb line 24 in process
File /app/vendor/bundle/ruby/2.7.0/gems/jsonapi-resources-0.9.10/lib/jsonapi/acts_as_resource_controller.rb line 86 in block in process_operations
File /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb line 101 in run_callbacks
File /app/vendor/bundle/ruby/2.7.0/gems/jsonapi-resources-0.9.10/lib/jsonapi/acts_as_resource_controller.rb line 85 in process_operations
File /app/vendor/bundle/ruby/2.7.0/gems/jsonapi-resources-0.9.10/lib/jsonapi/acts_as_resource_controller.rb line 77 in process_request
File /app/vendor/bundle/ruby/2.7.0/gems/jsonapi-resources-0.9.10/lib/jsonapi/acts_as_resource_controller.rb line 44 in update
File /app/vendor/bundle/ruby/2.7.0/gems/actionpack-6.0.3.4/lib/action_controller/metal/basic_implicit_render.rb line 6 in send_action
File /app/vendor/bundle/ruby/2.7.0/gems/actionpack-6.0.3.4/lib/abstract_controller/base.rb line 195 in process_action
File /app/vendor/bundle/ruby/2.7.0/gems/scout_apm-4.0.0/lib/scout_apm/instruments/action_controller_rails_3_rails4.rb line 117 in process_action
File /app/vendor/bundle/ruby/2.7.0/gems/actionpack-6.0.3.4/lib/action_controller/metal/rendering.rb line 30 in process_action
File /app/vendor/bundle/ruby/2.7.0/gems/actionpack-6.0.3.4/lib/abstract_controller/callbacks.rb line 42 in block in process_action
File /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb line 112 in block in run_callbacks

Sorry, just confirming, I can ignore the previous message? :)

#182 has a reproduction case for this problem, and also a proposed fix (which is implemented in #179)

@bf4, I think this may now be solved. Try master. Thanks again @fschwahn :)