sanger / labwhere

A tool for tracking uniquely barcoded labware
MIT License
3 stars 10 forks source link

DPL-214 [BUG] - Reduce exception noise - Labwhere - undefined method `id' for nil:NilClass (C=?, V=2) #464

Open stevieing opened 2 years ago

stevieing commented 2 years ago

Describe the bug This seems to be a bug that is not causing any user issues but it raises an exception email several times a day so needs to be investigated.

A NoMethodError occurred in background at 2022-01-04 10:46:41 +0000 :

undefined method id' for nil:NilClass /var/www/labwhere/releases/20210824115818/app/models/event.rb:29:infor_old_audit?'


Backtrace:

/var/www/labwhere/releases/20210824115818/app/models/event.rb:29:in for_old_audit?' /var/www/labwhere/releases/20210824115818/app/models/event.rb:67:incoordinate' /var/www/labwhere/releases/20210824115818/app/models/event.rb:143:in metadata' /var/www/labwhere/releases/20210824115818/app/models/event.rb:83:inas_json' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.6/lib/active_support/json/encoding.rb:35:in encode' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.6/lib/active_support/json/encoding.rb:22:inencode' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.6/lib/active_support/core_ext/object/json.rb:41:in to_json' /var/www/labwhere/releases/20210824115818/app/messages/messages/message.rb:13:inpayload' /var/www/labwhere/releases/20210824115818/app/messages/messages/broker.rb:90:in _publish' /var/www/labwhere/releases/20210824115818/app/messages/messages/broker.rb:80:inpublish' /var/www/labwhere/releases/20210824115818/app/messages/messages.rb:7:in block in publish' /var/www/labwhere/releases/20210824115818/app/messages/messages.rb:6:ineach' /var/www/labwhere/releases/20210824115818/app/messages/messages.rb:6:in publish' /var/www/labwhere/releases/20210824115818/app/models/labware.rb:85:inwrite_event' /var/www/labwhere/releases/20210824115818/app/models/concerns/auditable.rb:28:in create_audit_shared' /var/www/labwhere/releases/20210824115818/app/models/concerns/auditable.rb:18:increate_audit' /var/www/labwhere/releases/20210824115818/app/models/labware_collection/base.rb:24:in block (2 levels) in push' /var/www/labwhere/releases/20210824115818/app/models/labware_collection/base.rb:20:ineach' /var/www/labwhere/releases/20210824115818/app/models/labware_collection/base.rb:20:in each_with_index' /var/www/labwhere/releases/20210824115818/app/models/labware_collection/base.rb:20:inblock in push' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:265:in transaction' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.6/lib/active_record/transactions.rb:212:intransaction' /var/www/labwhere/releases/20210824115818/app/models/labware_collection/base.rb:19:in push' /var/www/labwhere/releases/20210824115818/app/models/labware_collection/unordered_location.rb:6:inpush' /var/www/labwhere/releases/20210824115818/app/forms/scan_form.rb:15:in block in <class:ScanForm>' /var/www/labwhere/releases/20210824115818/app/form_object/form_object.rb:111:ininstance_eval' /var/www/labwhere/releases/20210824115818/app/form_object/form_object.rb:111:in block (2 levels) in after_validate' /var/www/labwhere/releases/20210824115818/app/form_object/form_object.rb:177:inblock in run_transaction' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:267:in block in transaction' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract/transaction.rb:239:inblock in within_new_transaction' /home/ubuntu/.rbenv/versions/2.5.8/lib/ruby/2.5.0/monitor.rb:235:in mon_synchronize' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract/transaction.rb:236:inwithin_new_transaction' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:267:in transaction' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.6/lib/active_record/transactions.rb:212:intransaction' /var/www/labwhere/releases/20210824115818/app/form_object/form_object.rb:176:in run_transaction' /var/www/labwhere/releases/20210824115818/app/form_object/form_object.rb:110:inblock in after_validate' /var/www/labwhere/releases/20210824115818/app/form_object/form_object.rb:136:in block in submit' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.6/lib/active_support/callbacks.rb:98:inrun_callbacks' /var/www/labwhere/releases/20210824115818/app/form_object/form_object.rb:134:in submit' /var/www/labwhere/releases/20210824115818/app/controllers/scans_controller.rb:11:increate' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_controller/metal/basic_implicit_render.rb:6:in send_action' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/abstract_controller/base.rb:194:inprocess_action' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_controller/metal/rendering.rb:30:in process_action' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/abstract_controller/callbacks.rb:42:inblock in process_action' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.6/lib/active_support/callbacks.rb:132:in run_callbacks' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/abstract_controller/callbacks.rb:41:inprocess_action' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_controller/metal/rescue.rb:22:in process_action' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_controller/metal/instrumentation.rb:34:inblock in process_action' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.6/lib/active_support/notifications.rb:168:in block in instrument' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.6/lib/active_support/notifications/instrumenter.rb:23:ininstrument' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.6/lib/active_support/notifications.rb:168:in instrument' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_controller/metal/instrumentation.rb:32:inprocess_action' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_controller/metal/params_wrapper.rb:256:in process_action' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.6/lib/active_record/railties/controller_runtime.rb:24:inprocess_action' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/abstract_controller/base.rb:134:in process' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionview-5.2.6/lib/action_view/rendering.rb:32:inprocess' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_controller/metal.rb:191:in dispatch' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_controller/metal.rb:252:indispatch' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_dispatch/routing/route_set.rb:52:in dispatch' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_dispatch/routing/route_set.rb:34:inserve' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_dispatch/journey/router.rb:52:in block in serve' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_dispatch/journey/router.rb:35:ineach' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_dispatch/journey/router.rb:35:in serve' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_dispatch/routing/route_set.rb:840:incall' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/exception_notification-4.4.3/lib/exception_notification/rack.rb:49:in call' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/rack-2.0.9/lib/rack/tempfile_reaper.rb:15:incall' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/rack-2.0.9/lib/rack/etag.rb:25:in call' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/rack-2.0.9/lib/rack/conditional_get.rb:38:incall' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/rack-2.0.9/lib/rack/head.rb:12:in call' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_dispatch/http/content_security_policy.rb:18:incall' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/rack-2.0.9/lib/rack/session/abstract/id.rb:259:in context' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/rack-2.0.9/lib/rack/session/abstract/id.rb:253:incall' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_dispatch/middleware/cookies.rb:670:in call' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_dispatch/middleware/callbacks.rb:28:inblock in call' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.6/lib/active_support/callbacks.rb:98:in run_callbacks' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_dispatch/middleware/callbacks.rb:26:incall' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_dispatch/middleware/debug_exceptions.rb:61:in call' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_dispatch/middleware/show_exceptions.rb:33:incall' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/railties-5.2.6/lib/rails/rack/logger.rb:38:in call_app' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/railties-5.2.6/lib/rails/rack/logger.rb:28:incall' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_dispatch/middleware/remote_ip.rb:81:in call' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_dispatch/middleware/request_id.rb:27:incall' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/rack-2.0.9/lib/rack/method_override.rb:22:in call' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/rack-2.0.9/lib/rack/runtime.rb:22:incall' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.6/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in call' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_dispatch/middleware/executor.rb:14:incall' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_dispatch/middleware/static.rb:127:in call' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/rack-2.0.9/lib/rack/sendfile.rb:111:incall' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/rack-cors-1.1.1/lib/rack/cors.rb:100:in call' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/railties-5.2.6/lib/rails/engine.rb:524:incall' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/puma-5.4.0/lib/puma/configuration.rb:249:in call' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/puma-5.4.0/lib/puma/request.rb:77:inblock in handle_request' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/puma-5.4.0/lib/puma/thread_pool.rb:340:in with_force_shutdown' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/puma-5.4.0/lib/puma/request.rb:76:inhandle_request' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/puma-5.4.0/lib/puma/server.rb:440:in process_client' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/puma-5.4.0/lib/puma/thread_pool.rb:147:inblock in spawn_thread'


Data:

Look into what is causing this exception and discuss whether the fix is worthwhile with the team

stevieing commented 1 month ago

Apart from creating exceptions this does not cause any user issues.