Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bulk upload creates corrupt file attachments if it encounters a rollback #513

Open
fosterfarrell9 opened this issue Jun 5, 2023 · 1 comment
Assignees
Labels

Comments

@fosterfarrell9
Copy link
Collaborator

fosterfarrell9 commented Jun 5, 2023

Occasionally, we are seeing these exceptions in production:

 :type option required

/usr/local/bundle/gems/actionpack-7.0.4.3/lib/action_controller/metal/data_streaming.rb:121:in `send_file_headers!'
/usr/local/bundle/gems/actionpack-7.0.4.3/lib/action_controller/metal/data_streaming.rb:73:in `send_file'
/usr/local/bundle/gems/actionpack-7.0.4.3/lib/action_controller/metal/instrumentation.rb:30:in `block in send_file'
/usr/local/bundle/gems/activesupport-7.0.4.3/lib/active_support/notifications.rb:206:in `block in instrument'
/usr/local/bundle/gems/activesupport-7.0.4.3/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/usr/local/bundle/gems/activesupport-7.0.4.3/lib/active_support/notifications.rb:206:in `instrument'
/usr/local/bundle/gems/actionpack-7.0.4.3/lib/action_controller/metal/instrumentation.rb:28:in `send_file'
/usr/src/app/app/controllers/submissions_controller.rb:156:in `show_correction'
/usr/local/bundle/gems/actionpack-7.0.4.3/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
/usr/local/bundle/gems/actionpack-7.0.4.3/lib/abstract_controller/base.rb:215:in `process_action'
/usr/local/bundle/gems/actionpack-7.0.4.3/lib/action_controller/metal/rendering.rb:53:in `process_action'
/usr/local/bundle/gems/actionpack-7.0.4.3/lib/abstract_controller/callbacks.rb:234:in `block in process_action'
/usr/local/bundle/gems/activesupport-7.0.4.3/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/usr/local/bundle/gems/actiontext-7.0.4.3/lib/action_text/rendering.rb:20:in `with_renderer'
/usr/local/bundle/gems/actiontext-7.0.4.3/lib/action_text/engine.rb:69:in `block (4 levels) in <class:Engine>'
/usr/local/bundle/gems/activesupport-7.0.4.3/lib/active_support/callbacks.rb:127:in `instance_exec'
/usr/local/bundle/gems/activesupport-7.0.4.3/lib/active_support/callbacks.rb:127:in `block in run_callbacks'
/usr/local/bundle/gems/activesupport-7.0.4.3/lib/active_support/callbacks.rb:138:in `run_callbacks'
/usr/local/bundle/gems/actionpack-7.0.4.3/lib/abstract_controller/callbacks.rb:233:in `process_action'
/usr/local/bundle/gems/actionpack-7.0.4.3/lib/action_controller/metal/rescue.rb:22:in `process_action'
/usr/local/bundle/gems/actionpack-7.0.4.3/lib/action_controller/metal/instrumentation.rb:67:in `block in process_action'
/usr/local/bundle/gems/activesupport-7.0.4.3/lib/active_support/notifications.rb:206:in `block in instrument'
/usr/local/bundle/gems/activesupport-7.0.4.3/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/usr/local/bundle/gems/activesupport-7.0.4.3/lib/active_support/notifications.rb:206:in `instrument'
/usr/local/bundle/gems/actionpack-7.0.4.3/lib/action_controller/metal/instrumentation.rb:66:in `process_action'
/usr/local/bundle/gems/actionpack-7.0.4.3/lib/action_controller/metal/params_wrapper.rb:259:in `process_action'
/usr/local/bundle/gems/activerecord-7.0.4.3/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
/usr/local/bundle/gems/actionpack-7.0.4.3/lib/abstract_controller/base.rb:151:in `process'
/usr/local/bundle/gems/actionview-7.0.4.3/lib/action_view/rendering.rb:39:in `process'
/usr/local/bundle/gems/actionpack-7.0.4.3/lib/action_controller/metal.rb:188:in `dispatch'
/usr/local/bundle/gems/actionpack-7.0.4.3/lib/action_controller/metal.rb:251:in `dispatch'
/usr/local/bundle/gems/actionpack-7.0.4.3/lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
/usr/local/bundle/gems/actionpack-7.0.4.3/lib/action_dispatch/routing/route_set.rb:32:in `serve'
/usr/local/bundle/gems/actionpack-7.0.4.3/lib/action_dispatch/journey/router.rb:50:in `block in serve'
/usr/local/bundle/gems/actionpack-7.0.4.3/lib/action_dispatch/journey/router.rb:32:in `each'
/usr/local/bundle/gems/actionpack-7.0.4.3/lib/action_dispatch/journey/router.rb:32:in `serve'
/usr/local/bundle/gems/actionpack-7.0.4.3/lib/action_dispatch/routing/route_set.rb:852:in `call'
/usr/local/bundle/gems/warden-1.2.9/lib/warden/manager.rb:36:in `block in call'
/usr/local/bundle/gems/warden-1.2.9/lib/warden/manager.rb:34:in `catch'
/usr/local/bundle/gems/warden-1.2.9/lib/warden/manager.rb:34:in `call'
/usr/local/bundle/gems/rack-2.2.7/lib/rack/tempfile_reaper.rb:15:in `call'
/usr/local/bundle/gems/rack-2.2.7/lib/rack/etag.rb:27:in `call'
/usr/local/bundle/gems/rack-2.2.7/lib/rack/conditional_get.rb:27:in `call'
/usr/local/bundle/gems/rack-2.2.7/lib/rack/head.rb:12:in `call'
/usr/local/bundle/gems/actionpack-7.0.4.3/lib/action_dispatch/http/permissions_policy.rb:38:in `call'
/usr/local/bundle/gems/actionpack-7.0.4.3/lib/action_dispatch/http/content_security_policy.rb:36:in `call'
/usr/local/bundle/gems/rack-2.2.7/lib/rack/session/abstract/id.rb:266:in `context'
/usr/local/bundle/gems/rack-2.2.7/lib/rack/session/abstract/id.rb:260:in `call'
/usr/local/bundle/gems/actionpack-7.0.4.3/lib/action_dispatch/middleware/cookies.rb:704:in `call'
/usr/local/bundle/gems/actionpack-7.0.4.3/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
/usr/local/bundle/gems/activesupport-7.0.4.3/lib/active_support/callbacks.rb:99:in `run_callbacks'
/usr/local/bundle/gems/actionpack-7.0.4.3/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
/usr/local/bundle/gems/actionpack-7.0.4.3/lib/action_dispatch/middleware/debug_exceptions.rb:28:in `call'
/usr/local/bundle/gems/actionpack-7.0.4.3/lib/action_dispatch/middleware/show_exceptions.rb:26:in `call'
/usr/local/bundle/gems/railties-7.0.4.3/lib/rails/rack/logger.rb:40:in `call_app'
/usr/local/bundle/gems/railties-7.0.4.3/lib/rails/rack/logger.rb:25:in `block in call'
/usr/local/bundle/gems/activesupport-7.0.4.3/lib/active_support/tagged_logging.rb:99:in `block in tagged'
/usr/local/bundle/gems/activesupport-7.0.4.3/lib/active_support/tagged_logging.rb:37:in `tagged'
/usr/local/bundle/gems/activesupport-7.0.4.3/lib/active_support/tagged_logging.rb:99:in `tagged'
/usr/local/bundle/gems/railties-7.0.4.3/lib/rails/rack/logger.rb:25:in `call'
/usr/local/bundle/gems/actionpack-7.0.4.3/lib/action_dispatch/middleware/remote_ip.rb:93:in `call'
/usr/local/bundle/gems/request_store-1.5.1/lib/request_store/middleware.rb:19:in `call'
/usr/local/bundle/gems/actionpack-7.0.4.3/lib/action_dispatch/middleware/request_id.rb:26:in `call'
/usr/local/bundle/gems/rack-2.2.7/lib/rack/method_override.rb:24:in `call'
/usr/local/bundle/gems/rack-2.2.7/lib/rack/runtime.rb:22:in `call'
/usr/local/bundle/gems/activesupport-7.0.4.3/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
/usr/local/bundle/gems/actionpack-7.0.4.3/lib/action_dispatch/middleware/executor.rb:14:in `call'
/usr/local/bundle/gems/actionpack-7.0.4.3/lib/action_dispatch/middleware/static.rb:23:in `call'
/usr/local/bundle/gems/rack-2.2.7/lib/rack/sendfile.rb:110:in `call'
/usr/local/bundle/gems/actionpack-7.0.4.3/lib/action_dispatch/middleware/host_authorization.rb:131:in `call'
/usr/local/bundle/gems/prometheus_exporter-2.0.8/lib/prometheus_exporter/middleware.rb:41:in `call'
/usr/local/bundle/gems/railties-7.0.4.3/lib/rails/engine.rb:530:in `call'
/usr/local/bundle/gems/puma-4.3.12/lib/puma/configuration.rb:228:in `call'
/usr/local/bundle/gems/puma-4.3.12/lib/puma/server.rb:727:in `handle_request'
/usr/local/bundle/gems/puma-4.3.12/lib/puma/server.rb:476:in `process_client'
/usr/local/bundle/gems/puma-4.3.12/lib/puma/server.rb:332:in `block in run'
/usr/local/bundle/gems/puma-4.3.12/lib/puma/thread_pool.rb:134:in `block in spawn_thread'

Request Params
{"controller"=>"submissions", "action"=>"show_correction", "id"=>"[FILTERED]"} %>

We have not been able to reproduce them in development. Recently, a user gave us a hint as to what might be the issue here.
Namely, the user had (as a tutor) used the bulk upload for corrections. This failed because one of the included files exceeded the size limit, but some users still got a (somehow corrupt) correction attached. When they try to display them, the exception is triggered.

We should try to reproduce this in development. Possibly, the bulk_corrections! method in submissions.rb does not properly handle the case of a rollback of one single file in the bulk.

@fosterfarrell9 fosterfarrell9 changed the title Bulk upload creates corrupt if it encounters a rollback Bulk upload creates corrupt file attachments if it encounters a rollback Jun 5, 2023
@Splines Splines self-assigned this Jun 6, 2023
@Splines Splines added the bug label Jun 6, 2023
@Splines
Copy link
Member

Splines commented Jul 19, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants