hyrax: SystemStackError (stack level too deep) in Hyrax::FileSetsController#destroy
Using the UI to delete a FileSet from a Work fails when the Work has “many” FileSets
2.8.0, 3.0.0.pre.rc2
Rationale
This seems to be a new issue or regression. Possibly in underlying gems. Apologies but I don’t know enough about ActiveFedora/RDF to assign the issue to another gem.
Expected behavior
FileSet should be deleted as expected. I guess something is going wrong with rebuilding the ListSource (total guess). Something recursion-related, perhaps?
Actual behavior
Page spins for a while and then fails with SystemStackError (stack level too deep)
Steps to reproduce the behavior
- Add a bunch of FileSets to a new or existing Work. On fulcrum.org we’ve seen this failure with Works with 93 and 195 FileSets. On Nurax >=122 seems to cause it. Might as well ingest 150 to be sure. The issue is easily replicable in development.
aside: This is an easy way to make a bunch of small < 10KB files to use (causing minimal ingest overhead)
for i in {001..150}; do head -c 10000 </dev/urandom >randfile$i; done
for f in randfile*; do mv $f `printf randfile%03d ${f#randfile}`; done
- Allow ingest to complete.
- Delete any FileSet from the Work. Doesn’t matter if it’s at the start or end of the ListSource (ordered_members). The problem happens whether you use the drop-down delete action on the Work page or the “Delete This File” button on the FileSet page.
- Let the page spin and observe the eventual failure.
Stack trace from Nurax:
rdf (3.0.13) lib/rdf/mixin/enumerable.rb:480:in `include?'
rdf (3.0.13) lib/rdf/mixin/enumerable.rb:480:in `block in each_object'
rdf (3.0.13) lib/rdf/mixin/queryable.rb:291:in `<<'
rdf (3.0.13) lib/rdf/mixin/queryable.rb:291:in `block (2 levels) in enum_for'
rdf (3.0.13) lib/rdf/repository.rb:408:in `block (4 levels) in query_pattern'
hamster (3.0.0) lib/hamster/trie.rb:40:in `block in each'
hamster (3.0.0) lib/hamster/trie.rb:40:in `each'
hamster (3.0.0) lib/hamster/trie.rb:40:in `each'
hamster (3.0.0) lib/hamster/hash.rb:331:in `each'
rdf (3.0.13) lib/rdf/repository.rb:406:in `block (3 levels) in query_pattern'
hamster (3.0.0) lib/hamster/trie.rb:40:in `block in each'
hamster (3.0.0) lib/hamster/trie.rb:40:in `each'
hamster (3.0.0) lib/hamster/trie.rb:40:in `each'
hamster (3.0.0) lib/hamster/hash.rb:331:in `each'
rdf (3.0.13) lib/rdf/repository.rb:405:in `block (2 levels) in query_pattern'
rdf (3.0.13) lib/rdf/repository.rb:397:in `each'
rdf (3.0.13) lib/rdf/repository.rb:397:in `block in query_pattern'
hamster (3.0.0) lib/hamster/trie.rb:40:in `block in each'
hamster (3.0.0) lib/hamster/trie.rb:40:in `each'
hamster (3.0.0) lib/hamster/trie.rb:40:in `each'
hamster (3.0.0) lib/hamster/hash.rb:331:in `each'
rdf (3.0.13) lib/rdf/repository.rb:385:in `query_pattern'
rdf (3.0.13) lib/rdf/mixin/queryable.rb:291:in `block in enum_for'
rdf (3.0.13) lib/rdf/mixin/enumerable.rb:159:in `each'
rdf (3.0.13) lib/rdf/mixin/enumerable.rb:159:in `each'
rdf (3.0.13) lib/rdf/mixin/enumerable.rb:159:in `each_statement'
rdf (3.0.13) lib/rdf/mixin/enumerable.rb:478:in `each_object'
active-triples (1.1.0) lib/active_triples/util/extended_bounded_description.rb:63:in `each_statement'
.
.
.
#############################################################################
### This part repeats 122 times on Nurax (presumably once per FileSet until stack limit is reached) ###
active-triples (1.1.0) lib/active_triples/util/extended_bounded_description.rb:66:in `block in each_statement'
rdf (3.0.13) lib/rdf/mixin/enumerable.rb:482:in `block in each_object'
rdf (3.0.13) lib/rdf/mixin/queryable.rb:291:in `<<'
rdf (3.0.13) lib/rdf/mixin/queryable.rb:291:in `block (2 levels) in enum_for'
rdf (3.0.13) lib/rdf/repository.rb:408:in `block (4 levels) in query_pattern'
hamster (3.0.0) lib/hamster/trie.rb:40:in `block in each'
hamster (3.0.0) lib/hamster/trie.rb:40:in `each'
hamster (3.0.0) lib/hamster/trie.rb:40:in `each'
hamster (3.0.0) lib/hamster/hash.rb:331:in `each'
rdf (3.0.13) lib/rdf/repository.rb:406:in `block (3 levels) in query_pattern'
hamster (3.0.0) lib/hamster/trie.rb:40:in `block in each'
hamster (3.0.0) lib/hamster/trie.rb:40:in `each'
hamster (3.0.0) lib/hamster/trie.rb:40:in `each'
hamster (3.0.0) lib/hamster/hash.rb:331:in `each'
rdf (3.0.13) lib/rdf/repository.rb:405:in `block (2 levels) in query_pattern'
rdf (3.0.13) lib/rdf/repository.rb:397:in `each'
rdf (3.0.13) lib/rdf/repository.rb:397:in `block in query_pattern'
hamster (3.0.0) lib/hamster/trie.rb:40:in `block in each'
hamster (3.0.0) lib/hamster/trie.rb:40:in `each'
hamster (3.0.0) lib/hamster/trie.rb:40:in `each'
hamster (3.0.0) lib/hamster/hash.rb:331:in `each'
rdf (3.0.13) lib/rdf/repository.rb:385:in `query_pattern'
rdf (3.0.13) lib/rdf/mixin/queryable.rb:291:in `block in enum_for'
rdf (3.0.13) lib/rdf/mixin/enumerable.rb:159:in `each'
rdf (3.0.13) lib/rdf/mixin/enumerable.rb:159:in `each'
rdf (3.0.13) lib/rdf/mixin/enumerable.rb:159:in `each_statement'
rdf (3.0.13) lib/rdf/mixin/enumerable.rb:478:in `each_object'
active-triples (1.1.0) lib/active_triples/util/extended_bounded_description.rb:63:in `each_statement'
#############################################################################
.
.
.
rdf (3.0.13) lib/rdf/transaction.rb:77:in `each'
active-triples (1.1.0) lib/active_triples/rdf_source.rb:90:in `each'
rdf (3.0.13) lib/rdf/mixin/enumerable.rb:691:in `to_a'
rdf (3.0.13) lib/rdf/mixin/enumerable.rb:691:in `to_a'
active-triples (1.1.0) lib/active_triples/persistence_strategies/parent_strategy.rb:128:in `reload'
active-triples (1.1.0) lib/active_triples/persistable.rb:101:in `reload'
active-triples (1.1.0) lib/active_triples/rdf_source.rb:126:in `initialize'
active-triples (1.1.0) lib/active_triples/rdf_source.rb:703:in `new'
active-triples (1.1.0) lib/active_triples/rdf_source.rb:703:in `from_uri'
active-triples (1.1.0) lib/active_triples/relation.rb:583:in `make_node'
active-triples (1.1.0) lib/active_triples/relation.rb:469:in `convert_object'
active-triples (1.1.0) lib/active_triples/relation.rb:322:in `block in each'
rdf (3.0.13) lib/rdf/mixin/enumerable.rb:482:in `block in each_object'
rdf (3.0.13) lib/rdf/mixin/queryable.rb:291:in `<<'
rdf (3.0.13) lib/rdf/mixin/queryable.rb:291:in `block (2 levels) in enum_for'
rdf (3.0.13) lib/rdf/repository.rb:408:in `block (4 levels) in query_pattern'
hamster (3.0.0) lib/hamster/trie.rb:40:in `block in each'
hamster (3.0.0) lib/hamster/trie.rb:40:in `each'
hamster (3.0.0) lib/hamster/trie.rb:40:in `each'
hamster (3.0.0) lib/hamster/hash.rb:331:in `each'
rdf (3.0.13) lib/rdf/repository.rb:406:in `block (3 levels) in query_pattern'
rdf (3.0.13) lib/rdf/repository.rb:405:in `each'
rdf (3.0.13) lib/rdf/repository.rb:405:in `block (2 levels) in query_pattern'
rdf (3.0.13) lib/rdf/repository.rb:397:in `each'
rdf (3.0.13) lib/rdf/repository.rb:397:in `block in query_pattern'
rdf (3.0.13) lib/rdf/repository.rb:385:in `each'
rdf (3.0.13) lib/rdf/repository.rb:385:in `query_pattern'
rdf (3.0.13) lib/rdf/mixin/queryable.rb:291:in `block in enum_for'
rdf (3.0.13) lib/rdf/mixin/enumerable.rb:159:in `each'
rdf (3.0.13) lib/rdf/mixin/enumerable.rb:159:in `each'
rdf (3.0.13) lib/rdf/mixin/enumerable.rb:159:in `each_statement'
rdf (3.0.13) lib/rdf/mixin/enumerable.rb:478:in `each_object'
active-triples (1.1.0) lib/active_triples/relation.rb:487:in `objects'
active-triples (1.1.0) lib/active_triples/relation.rb:321:in `each'
active-triples (1.1.0) lib/active_triples/relation.rb:37:in `to_a'
active-triples (1.1.0) lib/active_triples/relation.rb:37:in `size'
active-fedora (13.2.0) lib/active_fedora/attributes/property_builder.rb:32:in `tail'
active-fedora (13.2.0) lib/active_fedora/attributes.rb:52:in `[]'
active-fedora (13.2.0) lib/active_fedora/attributes.rb:43:in `block in attributes'
active-fedora (13.2.0) lib/active_fedora/attributes.rb:43:in `each'
active-fedora (13.2.0) lib/active_fedora/attributes.rb:43:in `each_with_object'
active-fedora (13.2.0) lib/active_fedora/attributes.rb:43:in `attributes'
active-fedora (13.2.0) lib/active_fedora/attribute_methods/read.rb:39:in `_read_attribute'
activemodel (5.2.4.4) lib/active_model/dirty.rb:316:in `attribute_will_change!'
activemodel (5.2.4.4) lib/active_model/attribute_methods.rb:439:in `attribute_missing'
activemodel (5.2.4.4) lib/active_model/attribute_methods.rb:430:in `method_missing'
active-fedora (13.2.0) lib/active_fedora/aggregation/list_source.rb:69:in `persist_ordered_self'
active-fedora (13.2.0) lib/active_fedora/aggregation/list_source.rb:11:in `save'
active-fedora (13.2.0) lib/active_fedora/persistence.rb:263:in `block in save_contained_resources'
active-fedora (13.2.0) lib/active_fedora/persistence.rb:262:in `each'
active-fedora (13.2.0) lib/active_fedora/persistence.rb:262:in `save_contained_resources'
active-fedora (13.2.0) lib/active_fedora/persistence.rb:196:in `_update_record'
active-fedora (13.2.0) lib/active_fedora/indexing.rb:79:in `_update_record'
active-fedora (13.2.0) lib/active_fedora/callbacks.rb:249:in `block in _update_record'
activesupport (5.2.4.4) lib/active_support/callbacks.rb:132:in `run_callbacks'
activesupport (5.2.4.4) lib/active_support/callbacks.rb:816:in `_run_update_callbacks'
active-fedora (13.2.0) lib/active_fedora/callbacks.rb:249:in `_update_record'
active-fedora (13.2.0) lib/active_fedora/persistence.rb:179:in `create_or_update'
active-fedora (13.2.0) lib/active_fedora/callbacks.rb:241:in `block in create_or_update'
activesupport (5.2.4.4) lib/active_support/callbacks.rb:132:in `run_callbacks'
activesupport (5.2.4.4) lib/active_support/callbacks.rb:816:in `_run_save_callbacks'
active-fedora (13.2.0) lib/active_fedora/callbacks.rb:241:in `create_or_update'
active-fedora (13.2.0) lib/active_fedora/persistence.rb:44:in `save!'
active-fedora (13.2.0) lib/active_fedora/validations.rb:56:in `save!'
active-fedora (13.2.0) lib/active_fedora/associations/builder/orders.rb:50:in `save!'
hydra-works (1.2.0) lib/hydra/works/models/concerns/file_set_behavior.rb:76:in `block in remove_from_works'
hydra-works (1.2.0) lib/hydra/works/models/concerns/file_set_behavior.rb:73:in `each'
hydra-works (1.2.0) lib/hydra/works/models/concerns/file_set_behavior.rb:73:in `remove_from_works'
activesupport (5.2.4.4) lib/active_support/callbacks.rb:426:in `block in make_lambda'
activesupport (5.2.4.4) lib/active_support/callbacks.rb:198:in `block (2 levels) in halting'
activesupport (5.2.4.4) lib/active_support/callbacks.rb:606:in `block (2 levels) in default_terminator'
activesupport (5.2.4.4) lib/active_support/callbacks.rb:605:in `catch'
activesupport (5.2.4.4) lib/active_support/callbacks.rb:605:in `block in default_terminator'
activesupport (5.2.4.4) lib/active_support/callbacks.rb:199:in `block in halting'
activesupport (5.2.4.4) lib/active_support/callbacks.rb:513:in `block in invoke_before'
activesupport (5.2.4.4) lib/active_support/callbacks.rb:513:in `each'
activesupport (5.2.4.4) lib/active_support/callbacks.rb:513:in `invoke_before'
activesupport (5.2.4.4) lib/active_support/callbacks.rb:131:in `run_callbacks'
activesupport (5.2.4.4) lib/active_support/callbacks.rb:816:in `_run_destroy_callbacks'
active-fedora (13.2.0) lib/active_fedora/callbacks.rb:231:in `destroy'
/opt/nurax/shared/bundle/ruby/2.6.0/bundler/gems/hyrax-940e1003e35b/app/actors/hyrax/actors/file_set_actor.rb:127:in `destroy'
/opt/nurax/shared/bundle/ruby/2.6.0/bundler/gems/hyrax-940e1003e35b/app/controllers/hyrax/file_sets_controller.rb:51:in `destroy'
actionpack (5.2.4.4) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
actionpack (5.2.4.4) lib/abstract_controller/base.rb:194:in `process_action'
actionpack (5.2.4.4) lib/action_controller/metal/rendering.rb:30:in `process_action'
actionpack (5.2.4.4) lib/abstract_controller/callbacks.rb:42:in `block in process_action'
activesupport (5.2.4.4) lib/active_support/callbacks.rb:132:in `run_callbacks'
actionpack (5.2.4.4) lib/abstract_controller/callbacks.rb:41:in `process_action'
actionpack (5.2.4.4) lib/action_controller/metal/rescue.rb:22:in `process_action'
actionpack (5.2.4.4) lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
activesupport (5.2.4.4) lib/active_support/notifications.rb:168:in `block in instrument'
activesupport (5.2.4.4) lib/active_support/notifications/instrumenter.rb:23:in `instrument'
activesupport (5.2.4.4) lib/active_support/notifications.rb:168:in `instrument'
actionpack (5.2.4.4) lib/action_controller/metal/instrumentation.rb:32:in `process_action'
actionpack (5.2.4.4) lib/action_controller/metal/params_wrapper.rb:256:in `process_action'
activerecord (5.2.4.4) lib/active_record/railties/controller_runtime.rb:24:in `process_action'
actionpack (5.2.4.4) lib/abstract_controller/base.rb:134:in `process'
actionview (5.2.4.4) lib/action_view/rendering.rb:32:in `process'
actionpack (5.2.4.4) lib/action_controller/metal.rb:191:in `dispatch'
actionpack (5.2.4.4) lib/action_controller/metal.rb:252:in `dispatch'
actionpack (5.2.4.4) lib/action_dispatch/routing/route_set.rb:52:in `dispatch'
actionpack (5.2.4.4) lib/action_dispatch/routing/route_set.rb:34:in `serve'
actionpack (5.2.4.4) lib/action_dispatch/journey/router.rb:52:in `block in serve'
actionpack (5.2.4.4) lib/action_dispatch/journey/router.rb:35:in `each'
actionpack (5.2.4.4) lib/action_dispatch/journey/router.rb:35:in `serve'
actionpack (5.2.4.4) lib/action_dispatch/routing/route_set.rb:840:in `call'
warden (1.2.8) lib/warden/manager.rb:36:in `block in call'
warden (1.2.8) lib/warden/manager.rb:34:in `catch'
warden (1.2.8) lib/warden/manager.rb:34:in `call'
rack (2.2.3) lib/rack/tempfile_reaper.rb:15:in `call'
rack (2.2.3) lib/rack/etag.rb:27:in `call'
rack (2.2.3) lib/rack/conditional_get.rb:40:in `call'
rack (2.2.3) lib/rack/head.rb:12:in `call'
actionpack (5.2.4.4) lib/action_dispatch/http/content_security_policy.rb:18:in `call'
rack (2.2.3) lib/rack/session/abstract/id.rb:266:in `context'
rack (2.2.3) lib/rack/session/abstract/id.rb:260:in `call'
actionpack (5.2.4.4) lib/action_dispatch/middleware/cookies.rb:670:in `call'
active-fedora (13.2.0) lib/active_fedora/ldp_cache.rb:26:in `call'
flipflop (2.6.0) lib/flipflop/feature_cache.rb:12:in `call'
actionpack (5.2.4.4) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (5.2.4.4) lib/active_support/callbacks.rb:98:in `run_callbacks'
actionpack (5.2.4.4) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
actionpack (5.2.4.4) lib/action_dispatch/middleware/debug_exceptions.rb:61:in `call'
actionpack (5.2.4.4) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
railties (5.2.4.4) lib/rails/rack/logger.rb:38:in `call_app'
railties (5.2.4.4) lib/rails/rack/logger.rb:26:in `block in call'
activesupport (5.2.4.4) lib/active_support/tagged_logging.rb:71:in `block in tagged'
activesupport (5.2.4.4) lib/active_support/tagged_logging.rb:28:in `tagged'
activesupport (5.2.4.4) lib/active_support/tagged_logging.rb:71:in `tagged'
railties (5.2.4.4) lib/rails/rack/logger.rb:26:in `call'
actionpack (5.2.4.4) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
request_store (1.5.0) lib/request_store/middleware.rb:19:in `call'
actionpack (5.2.4.4) lib/action_dispatch/middleware/request_id.rb:27:in `call'
rack (2.2.3) lib/rack/method_override.rb:24:in `call'
rack (2.2.3) lib/rack/runtime.rb:22:in `call'
activesupport (5.2.4.4) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
actionpack (5.2.4.4) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (5.2.4.4) lib/action_dispatch/middleware/static.rb:127:in `call'
rack (2.2.3) lib/rack/sendfile.rb:110:in `call'
honeybadger (3.3.0) lib/honeybadger/rack/error_notifier.rb:33:in `block in call'
honeybadger (3.3.0) lib/honeybadger/agent.rb:337:in `with_rack_env'
honeybadger (3.3.0) lib/honeybadger/rack/error_notifier.rb:30:in `call'
honeybadger (3.3.0) lib/honeybadger/rack/user_feedback.rb:31:in `call'
honeybadger (3.3.0) lib/honeybadger/rack/user_informer.rb:21:in `call'
railties (5.2.4.4) lib/rails/engine.rb:524:in `call'
passenger (6.0.4) src/ruby_supportlib/phusion_passenger/rack/thread_handler_extension.rb:97:in `process_request'
passenger (6.0.4) src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb:157:in `accept_and_process_next_request'
passenger (6.0.4) src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb:110:in `main_loop'
passenger (6.0.4) src/ruby_supportlib/phusion_passenger/request_handler.rb:415:in `block (3 levels) in start_threads'
passenger (6.0.4) src/ruby_supportlib/phusion_passenger/utils.rb:113:in `block in create_thread_and_abort_on_exception'
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 20 (17 by maintainers)
Commits related to this issue
- Short circuit ActiveModel::Dirty which attempts to load the whole ordered list when calling nodes_will_change! which leads to a stack level too deep exception in some cases See https://github.com/samv... — committed to samvera/active_fedora by cjcolvar 3 years ago
- Short circuit ActiveModel::Dirty which attempts to load the whole ordered list when calling nodes_will_change! which leads to a stack level too deep exception in some cases See https://github.com/samv... — committed to samvera/active_fedora by cjcolvar 3 years ago
- Short circuit ActiveModel::Dirty which attempts to load the whole ordered list when calling nodes_will_change! (#1442) which leads to a stack level too deep exception in some cases See https://githu... — committed to samvera/active_fedora by cjcolvar 3 years ago
- Increase ruby stack size limit Based on recommendation for resolving "Stack level too deep" errors, found here: https://github.com/samvera/hyrax/issues/4581#issuecomment-957872071 — committed to avalonmediasystem/avalon by masaball a year ago
I believe we’ve hit a similar error to this in our somewhat-modified Hyrax application (currently running on 2.9.0) using many different work types with many different parent-child relationships between works. Namely, if we have a work with over 120 or so child works, and we try to create a new child work nested inside the parent work (using the AddToWorkActor to accomplish the nesting), we hit a stack level too deep error on saving the parent work. @cjcolvar 's monkey-patch seems to have fixed this error for us (thanks!), but I’m not yet finished testing things after adding it.