summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-03-16 23:14:12 -0700
committerStan Hu <stanhu@gmail.com>2018-03-16 23:14:43 -0700
commitca63603d052808b7a5ab9b04acc611215e23a8c3 (patch)
treea0d06e4272ff908b94d99341ce3a488822feffc4
parentea5221aeb358ef6c349cfa09b9c6993bd7bd027d (diff)
downloadgitlab-ce-ca63603d052808b7a5ab9b04acc611215e23a8c3.tar.gz
Fix "Can't modify frozen hash" error when project is destroyedsh-fix-failure-project-destroy
Partial fix to #44378
-rw-r--r--app/services/projects/destroy_service.rb6
-rw-r--r--changelogs/unreleased/sh-fix-failure-project-destroy.yml5
2 files changed, 10 insertions, 1 deletions
diff --git a/app/services/projects/destroy_service.rb b/app/services/projects/destroy_service.rb
index 81972df9b3c..4b8f955ae69 100644
--- a/app/services/projects/destroy_service.rb
+++ b/app/services/projects/destroy_service.rb
@@ -88,7 +88,11 @@ module Projects
def attempt_rollback(project, message)
return unless project
- project.update_attributes(delete_error: message, pending_delete: false)
+ # It's possible that the project was destroyed, but some after_commit
+ # hook failed and caused us to end up here. A destroyed model will be a frozen hash,
+ # which cannot be altered.
+ project.update_attributes(delete_error: message, pending_delete: false) unless project.destroyed?
+
log_error("Deletion failed on #{project.full_path} with the following message: #{message}")
end
diff --git a/changelogs/unreleased/sh-fix-failure-project-destroy.yml b/changelogs/unreleased/sh-fix-failure-project-destroy.yml
new file mode 100644
index 00000000000..d5f5cd3f954
--- /dev/null
+++ b/changelogs/unreleased/sh-fix-failure-project-destroy.yml
@@ -0,0 +1,5 @@
+---
+title: Fix "Can't modify frozen hash" error when project is destroyed
+merge_request:
+author:
+type: fixed