Sporadic error when fetching related objects
larskanis opened this issue · 0 comments
larskanis commented
This issue is a (choose one):
- Problem/bug report.
Checklist before submitting:
- I've searched for an existing issue.
- I've asked my question on Gitter and have not received a satisfactory answer.
- I've included a complete bug report template. This step helps us and allows us to see the bug without trying to reproduce the problem from your description. It helps you because you will frequently detect if it's a problem specific to your project.
Description
Relationship objects are used as key in @join_details
in JoinManager . This hash contains two types of objects: String and Relationship. In case of hash collisions in @join_details
the method Relationship#eql?
is called. It currently fails when comparing with a string key.
Reproducible script is here: https://gist.github.com/larskanis/16af0f9e37eac17f27800468a5a6acab
It must be started a hundred times but fails eventually with the following error:
E, [2020-11-11T13:39:24.616237 #28095] ERROR -- : Internal Server Error: undefined method `relationship' for "":String /home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/jsonapi-resources-0.10.2/lib/jsonapi/path_segment.rb:33:in `eql?'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/jsonapi-resources-0.10.2/lib/jsonapi/active_relation/join_manager.rb:124:in `has_key?'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/jsonapi-resources-0.10.2/lib/jsonapi/active_relation/join_manager.rb:124:in `add_join_details'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/jsonapi-resources-0.10.2/lib/jsonapi/active_relation/join_manager.rb:185:in `block (2 levels) in perform_joins'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/jsonapi-resources-0.10.2/lib/jsonapi/active_relation/join_manager.rb:150:in `each'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/jsonapi-resources-0.10.2/lib/jsonapi/active_relation/join_manager.rb:150:in `block in perform_joins'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/jsonapi-resources-0.10.2/lib/jsonapi/active_relation/join_manager.rb:149:in `each'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/jsonapi-resources-0.10.2/lib/jsonapi/active_relation/join_manager.rb:149:in `perform_joins'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/jsonapi-resources-0.10.2/lib/jsonapi/active_relation/join_manager.rb:41:in `join'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/jsonapi-resources-0.10.2/lib/jsonapi/active_relation_resource.rb:720:in `apply_joins'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/jsonapi-resources-0.10.2/lib/jsonapi/active_relation_resource.rb:695:in `apply_request_settings_to_records'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/jsonapi-resources-0.10.2/lib/jsonapi/active_relation_resource.rb:400:in `find_related_monomorphic_fragments'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/jsonapi-resources-0.10.2/lib/jsonapi/active_relation_resource.rb:213:in `find_related_fragments'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/jsonapi-resources-0.10.2/lib/jsonapi/processor.rb:420:in `find_resource_id_tree_from_resource_relationship'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/jsonapi-resources-0.10.2/lib/jsonapi/processor.rb:380:in `find_related_resource_set'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/jsonapi-resources-0.10.2/lib/jsonapi/processor.rb:192:in `show_related_resources'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/jsonapi-resources-0.10.2/lib/jsonapi/processor.rb:34:in `block (2 levels) in process'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb:101:in `run_callbacks'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/jsonapi-resources-0.10.2/lib/jsonapi/processor.rb:33:in `block in process'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb:101:in `run_callbacks'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/jsonapi-resources-0.10.2/lib/jsonapi/processor.rb:32:in `process'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/jsonapi-resources-0.10.2/lib/jsonapi/operation.rb:12:in `process'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/jsonapi-resources-0.10.2/lib/jsonapi/acts_as_resource_controller.rb:140:in `process_operation'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/jsonapi-resources-0.10.2/lib/jsonapi/acts_as_resource_controller.rb:110:in `block (3 levels) in process_request'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/jsonapi-resources-0.10.2/lib/jsonapi/request_parser.rb:32:in `each'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/jsonapi-resources-0.10.2/lib/jsonapi/acts_as_resource_controller.rb:97:in `block (2 levels) in process_request'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb:101:in `run_callbacks'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/jsonapi-resources-0.10.2/lib/jsonapi/acts_as_resource_controller.rb:96:in `block in process_request'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/jsonapi-resources-0.10.2/lib/jsonapi/acts_as_resource_controller.rb:132:in `process_operations'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/jsonapi-resources-0.10.2/lib/jsonapi/acts_as_resource_controller.rb:95:in `process_request'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/jsonapi-resources-0.10.2/lib/jsonapi/acts_as_resource_controller.rb:59:in `index_related_resources'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/actionpack-6.0.3.4/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/actionpack-6.0.3.4/lib/abstract_controller/base.rb:195:in `process_action'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/actionpack-6.0.3.4/lib/action_controller/metal/rendering.rb:30:in `process_action'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/actionpack-6.0.3.4/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb:101:in `run_callbacks'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/actionpack-6.0.3.4/lib/abstract_controller/callbacks.rb:41:in `process_action'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/actionpack-6.0.3.4/lib/action_controller/metal/rescue.rb:22:in `process_action'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/actionpack-6.0.3.4/lib/action_controller/metal/instrumentation.rb:33:in `block in process_action'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.4/lib/active_support/notifications.rb:180:in `block in instrument'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.4/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.4/lib/active_support/notifications.rb:180:in `instrument'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/actionpack-6.0.3.4/lib/action_controller/metal/instrumentation.rb:32:in `process_action'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/actionpack-6.0.3.4/lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/actionpack-6.0.3.4/lib/abstract_controller/base.rb:136:in `process'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/actionview-6.0.3.4/lib/action_view/rendering.rb:39:in `process'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/actionpack-6.0.3.4/lib/action_controller/metal.rb:190:in `dispatch'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/actionpack-6.0.3.4/lib/action_controller/metal.rb:254:in `dispatch'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/route_set.rb:33:in `serve'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/actionpack-6.0.3.4/lib/action_dispatch/journey/router.rb:49:in `block in serve'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/actionpack-6.0.3.4/lib/action_dispatch/journey/router.rb:32:in `each'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/actionpack-6.0.3.4/lib/action_dispatch/journey/router.rb:32:in `serve'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/route_set.rb:834:in `call'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/rack-2.2.3/lib/rack/tempfile_reaper.rb:15:in `call'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/rack-2.2.3/lib/rack/etag.rb:27:in `call'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/rack-2.2.3/lib/rack/conditional_get.rb:27:in `call'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/rack-2.2.3/lib/rack/head.rb:12:in `call'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/actionpack-6.0.3.4/lib/action_dispatch/http/content_security_policy.rb:18:in `call'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/rack-2.2.3/lib/rack/session/abstract/id.rb:266:in `context'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/rack-2.2.3/lib/rack/session/abstract/id.rb:260:in `call'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/cookies.rb:648:in `call'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb:101:in `run_callbacks'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/executor.rb:14:in `call'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/debug_exceptions.rb:32:in `call'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/railties-6.0.3.4/lib/rails/rack/logger.rb:37:in `call_app'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/railties-6.0.3.4/lib/rails/rack/logger.rb:28:in `call'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/request_id.rb:27:in `call'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/rack-2.2.3/lib/rack/method_override.rb:24:in `call'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/rack-2.2.3/lib/rack/runtime.rb:22:in `call'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.4/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/executor.rb:14:in `call'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/static.rb:126:in `call'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/rack-2.2.3/lib/rack/sendfile.rb:110:in `call'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/host_authorization.rb:82:in `call'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/railties-6.0.3.4/lib/rails/engine.rb:527:in `call'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/rack-test-1.1.0/lib/rack/mock_session.rb:29:in `request'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/rack-test-1.1.0/lib/rack/test.rb:266:in `process_request'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/rack-test-1.1.0/lib/rack/test.rb:129:in `custom_request'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/rack-test-1.1.0/lib/rack/test.rb:58:in `get'
/home/local/COMCARD-NT/kanis/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/forwardable.rb:235:in `get'
test-error-hash.rb:126:in `block in test_index_your_models'
test-error-hash.rb:121:in `times'
test-error-hash.rb:121:in `test_index_your_models'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/minitest-5.14.2/lib/minitest/test.rb:98:in `block (3 levels) in run'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/minitest-5.14.2/lib/minitest/test.rb:195:in `capture_exceptions'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/minitest-5.14.2/lib/minitest/test.rb:95:in `block (2 levels) in run'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/minitest-5.14.2/lib/minitest.rb:272:in `time_it'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/minitest-5.14.2/lib/minitest/test.rb:94:in `block in run'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/minitest-5.14.2/lib/minitest.rb:367:in `on_signal'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/minitest-5.14.2/lib/minitest/test.rb:211:in `with_info_handler'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/minitest-5.14.2/lib/minitest/test.rb:93:in `run'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/minitest-5.14.2/lib/minitest.rb:1029:in `run_one_method'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/minitest-5.14.2/lib/minitest.rb:341:in `run_one_method'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/minitest-5.14.2/lib/minitest.rb:328:in `block (2 levels) in run'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/minitest-5.14.2/lib/minitest.rb:327:in `each'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/minitest-5.14.2/lib/minitest.rb:327:in `block in run'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/minitest-5.14.2/lib/minitest.rb:367:in `on_signal'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/minitest-5.14.2/lib/minitest.rb:354:in `with_info_handler'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/minitest-5.14.2/lib/minitest.rb:326:in `run'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/minitest-5.14.2/lib/minitest.rb:164:in `block in __run'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/minitest-5.14.2/lib/minitest.rb:164:in `map'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/minitest-5.14.2/lib/minitest.rb:164:in `__run'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/minitest-5.14.2/lib/minitest.rb:141:in `run'
/home/local/COMCARD-NT/kanis/.rvm/gems/ruby-2.7.1/gems/minitest-5.14.2/lib/minitest.rb:68:in `block in autorun'
I, [2020-11-11T13:39:24.622121 #28095] INFO -- : Completed 500 Internal Server Error in 16ms (Views: 1.0ms | Allocations: 8220)