Unhandled merge request 500 error on creation due to MySQL BLOB size limitation
Created by: mjdetullio
So, we have some branches that are radically different and sometimes my users accidentally pick the wrong branches when making a merge request. On creation, it wants to store the diff in MySQL, but the BLOB is pretty huge so it throws an error.
The merge request still gets created, but a 500 error is shown instead
Is there a better way to handle errors on creation? Often times I see duplicates being created, possibly due to back button or from the person going back and trying again (they don't realize it was actually created).
I don't want to store the BLOB, just handle the error better.
Below is the production log.
Edit: 4.1 stable production instance
Thanks
Processing by MergeRequestsController#branch_from as */*
Parameters: {"ref"=>"", "project_id"=>"my-namespace/my-project"}
Processing by MergeRequestsController#branch_to as */*
Parameters: {"ref"=>"", "project_id"=>"my-namespace/my-project"}
Rendered merge_requests/branch_from.js.haml (0.3ms)
Completed 200 OK in 40ms (Views: 1.3ms | ActiveRecord: 2.2ms)
Rendered merge_requests/branch_to.js.haml (0.3ms)
Completed 200 OK in 45ms (Views: 1.4ms | ActiveRecord: 2.1ms)
Started GET "/my-namespace/my-project/merge_requests/branch_from?ref=feature%2Fexample" for 127.0.0.1 at 2013-01-25 15:10:18 -0500
Processing by MergeRequestsController#branch_from as */*
Parameters: {"ref"=>"feature/example", "project_id"=>"my-namespace/my-project"}
Rendered commits/_commit.html.haml (4.5ms)
Rendered merge_requests/branch_from.js.haml (5.4ms)
Completed 200 OK in 114ms (Views: 5.9ms | ActiveRecord: 2.6ms)
Started GET "/my-namespace/my-project/merge_requests/branch_to?ref=master" for 127.0.0.1 at 2013-01-25 15:10:21 -0500
Processing by MergeRequestsController#branch_to as */*
Parameters: {"ref"=>"master", "project_id"=>"my-namespace/my-project"}
Rendered commits/_commit.html.haml (4.2ms)
Rendered merge_requests/branch_to.js.haml (5.0ms)
Completed 200 OK in 45ms (Views: 5.6ms | ActiveRecord: 2.5ms)
Started POST "/my-namespace/my-project/merge_requests" for 127.0.0.1 at 2013-01-25 15:10:33 -0500
Processing by MergeRequestsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"O2idhXDfwDrnvh0YuxZoqSxwyTMW6Qx1clo/DM+zpgw=", "merge_request"=>{"source_branch"=>"feature/example", "target_branch"=>"master", "title"=>"mr-title", "assignee_id"=>"3", "milestone_id"=>""}, "project_id"=>"my-namespace/my-project"}
Rendered notify/new_merge_request_email.html.haml within layouts/notify (4.0ms)
Sent mail to [email protected] (53ms)
Completed 500 Internal Server Error in 3731ms
ActiveRecord::StatementInvalid (Mysql2::Error: Got a packet bigger than 'max_allowed_packet' bytes: UPDATE `merge_requests` SET `st_diffs` = '---\n- !ruby/object:Grit::Diff\n repo: &88463700 !ruby/object:Grit::Repo\n path: /home/git/repositories/my-namespace/my-project.git\n bare: true\n git: !ruby/object:Grit::Git\n git_dir: /home/git/repositories/my-namespace/my-project.git\n work_tree: /home/git/repositories/my-namespace/my-project.git\n bytes_read: 0\n a_path: !binary |-\n V2ViQ29udGVudC9XRUItSU5GL3Jlc291cmNlcy9zcWwvYXBwbGljYXRpb25T\n cWwucHJvcGVydGllcw==\n b_path: !binary |-\n V2ViQ29udGVudC9XRUItSU5GL3Jlc291cmNlcy9zcWwvYXBwbGljYXRpb25T\n cWwucHJvcGVydGllcw==\n a_blob: !ruby/object:Grit::Blob\n repo: *88463700\n id: !binary |-\n ZWY4OTZmNw==\n b_blob: !ruby/object:Grit::Blob\n repo: *88463700\n id: !binary |-\n ZmYzODU0MA==\n a_mode: \n b_mode: !binary |-\n MTAwNjQ0\n new_file: false\n deleted_file: false\n renamed_file: false\n similarity_index: 0\n diff: !binary |-\n LS0tIGEvV2ViQ29udGVudC9XRUItSU5GL3Jlc291cmNlcy9zcWwvYXBwbGlj\n YXRpb25TcWwucHJvcGVydGllcworKysgYi9XZWJDb250ZW50L1dFQi1JTkYv\n cmVzb3VyY2VzL3NxbC9hcHBsaWNhdGlvblNxbC5wcm9wZXJ0aWVzCkBAIC00\n MCwxNCArNDAsMTggQEAgSmRiY0F0dHJpYnV0ZVZhbHVlRGFvLmRlbGV0ZUF0\n dHJpYnV0ZVZhbHVlU3FsPUR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