Defect #8546

Can't Delete Project - StaleObjectError

Added by Josh Davidson over 8 years ago. Updated about 1 year ago.

Status:ClosedStart date:2011-06-06
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-
Resolution:Cant reproduce Affected version:1.2.0

Description

  1. your database version - MySQL 5.1.56
  2. your Ruby version - 1.8.7 (i686-linux)
  3. your Rails version - 2.3.11

I copied an existing project to test a misbehaving plugin, and now I am unable to delete it. Redmine is complaining that an issue is stale (see below). I've tried logging out and back in and performing the action as a different administrator, but the result is the same. I delete the project and Redmine doesn't remove it.

Processing ProjectsController#destroy (for 127.0.0.1 at 2011-06-06 13:22:49) [DELETE]
  Parameters: {"commit"=>"Delete", "action"=>"destroy", "_method"=>"delete", "authenticity_token"=>"qwfGXcfHT+dqg0j9aS9k06/nFLTNYi1z7+YIZlGrB+c=", "id"=>"asttemp", "controller"=>"projects"}
Rendering template within layouts/base
Rendering projects/destroy
Completed in 32ms (View: 28, DB: 1) | 200 OK [http://127.0.0.1/redmine/projects/asttemp]

Processing ProjectsController#destroy (for 127.0.0.1 at 2011-06-06 13:22:52) [DELETE]
  Parameters: {"commit"=>"Delete", "confirm"=>"1", "action"=>"destroy", "_method"=>"delete", "authenticity_token"=>"qwfGXcfHT+dqg0j9aS9k06/nFLTNYi1z7+YIZlGrB+c=", "id"=>"asttemp", "controller"=>"projects"}

ActiveRecord::StaleObjectError (Attempted to delete a stale object: Issue):
  (eval):4:in `destroy_without_callbacks'
  app/controllers/projects_controller.rb:234:in `destroy'
  config/initializers/mongrel_cluster_with_rails_211_fix.rb:62:in `dispatch_cgi'

Processing ProjectsController#show (for 127.0.0.1 at 2011-06-06 13:22:58) [GET]
  Parameters: {"action"=>"show", "id"=>"asttemp", "controller"=>"projects"}
Rendering template within layouts/base
Rendering projects/show
Completed in 164ms (View: 116, DB: 12) | 200 OK [http://127.0.0.1/redmine/projects/asttemp]

destroy_project_failure.txt Magnifier - Redmine log (7.02 KB) Stéphane Gourichon, 2011-06-11 23:34

History

#1 Updated by Stéphane Gourichon over 8 years ago

Hello. Same problem here. Small part of log below, full trace attached.

  • redmine version and dependencies packaged by Ondřej Surý : 1.2.0-1~lucid+3 but I guess the bug is in plain redmine.
  • your database version - MySQL 5.1.41-3ubuntu12
  • your Ruby version - 1.8.7.302-2~lucid+1
  • your Rails version - 2.3.11-0.1~lucid+1
Processing ProjectsController#destroy (for 192.168.46.254 at 2011-06-11 21:08:20) [DELETE]
  Parameters: {"commit"=>"Supprimer", "confirm"=>"1", "action"=>"destroy", "_method"=>"delete", "authenticity_token"=>"PQA8bNlXJv1NeUSO7TtuDjR5j34exJJk5y/x/sAAXXE=", "id"=>"leclerc-galois", "controller"=>"projects"}

ActiveRecord::StaleObjectError (Attempted to delete a stale object: Issue):
  /usr/lib/ruby/1.8/active_record/locking/optimistic.rb:127:in `destroy_without_habtm_shim_for_changesets'
  (eval):4:in `destroy_without_callbacks'

Recent history :

  • was using redmine from 1.1 branch, never tried to delete a project there
  • dumped database to SQL text
  • installed 1.2 package, restored database from SQL text
  • another instance running on same redmine 1.2, with database restored from a slightly older backup, I can delete all projects except this one (not tried other combinations)

Simplest local workaround is to "archive" (hide) the project, but that will not help fix the actual bug.

I'm willing to provide more information and perform tests (including e.g. destructive tests on old 1.1-based setup).
Please tell me what to do.

#2 Updated by Caio Cunha over 8 years ago

Hi, there. Similar problem here.

When deleting a project with subtasks and relations the project never gets deleted. I started the Webrick server to see the output and got this:

ActiveRecord::StaleObjectError (Attempted to delete a stale object: Issue):
  (eval):4:in `destroy_without_callbacks'
  app/controllers/projects_controller.rb:234:in `destroy'
  /usr/share/ruby/ruby-1.8.7-p334/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
  /usr/share/ruby/ruby-1.8.7-p334/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
  /usr/share/ruby/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
  /usr/share/ruby/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:162:in `start'
  /usr/share/ruby/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
  /usr/share/ruby/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:95:in `start'
  /usr/share/ruby/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:92:in `each'
  /usr/share/ruby/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:92:in `start'
  /usr/share/ruby/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:23:in `start'
  /usr/share/ruby/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:82:in `start'

Saw this issue #7920, seems to be related. Not sure anyway. Did you guys where able to solve the problem?

Cheers,
CaioToOn!

#3 Updated by Jeferson Siegmund about 8 years ago

I have the same problem too. Using redmine 1.2.1.

Processing ProjectsController#destroy (for 10.1.1.38 at 2011-07-21 10:33:37) [DELETE]
  Parameters: {"commit"=>"Delete", "confirm"=>"1", "action"=>"destroy", "_method"=>"delete", "authenticity_token"=>"0Nf3iluVpsg7Ky4578+nYJayBZ0aQiefKXnjyqjCmGY=", "id"=>"nvmodprojmetsadig", "controller"=>"projects"}

ActiveRecord::StaleObjectError (Attempted to delete a stale object: Issue):
  (eval):4:in `destroy_without_callbacks'
  app/controllers/projects_controller.rb:235:in `destroy'
  passenger (2.2.15) lib/phusion_passenger/rack/request_handler.rb:92:in `process_request'
  passenger (2.2.15) lib/phusion_passenger/abstract_request_handler.rb:207:in `main_loop'
  passenger (2.2.15) lib/phusion_passenger/railz/application_spawner.rb:441:in `start_request_handler'
  passenger (2.2.15) lib/phusion_passenger/railz/application_spawner.rb:381:in `handle_spawn_application'
  passenger (2.2.15) lib/phusion_passenger/utils.rb:252:in `safe_fork'
  passenger (2.2.15) lib/phusion_passenger/railz/application_spawner.rb:377:in `handle_spawn_application'
  passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:352:in `__send__'
  passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
  passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
  passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:163:in `start'
  passenger (2.2.15) lib/phusion_passenger/railz/application_spawner.rb:222:in `start'
  passenger (2.2.15) lib/phusion_passenger/spawn_manager.rb:253:in `spawn_rails_application'
  passenger (2.2.15) lib/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
  passenger (2.2.15) lib/phusion_passenger/spawn_manager.rb:247:in `spawn_rails_application'
  passenger (2.2.15) lib/phusion_passenger/abstract_server_collection.rb:80:in `synchronize'
  passenger (2.2.15) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
  passenger (2.2.15) lib/phusion_passenger/spawn_manager.rb:246:in `spawn_rails_application'
  passenger (2.2.15) lib/phusion_passenger/spawn_manager.rb:145:in `spawn_application'
  passenger (2.2.15) lib/phusion_passenger/spawn_manager.rb:278:in `handle_spawn_application'
  passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:352:in `__send__'
  passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
  passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'

#4 Updated by Fernando Hartmann about 8 years ago

+1

To delete the project I had to delete all issues in the project, then the delete worked.

Detail ... When I tried to delete the tasks i had to delete first the subtasks, when I tried to delete all tasks in one delete I received the same error reported in this bug.]

#5 Updated by rafael mello about 8 years ago

+1

Same as @Stéphane Gourichon.
I just upgrade to 1.2.1 and I can't delete a project, but I never tried to delete on 1.0.4.

#6 Updated by Fernando Hartmann about 8 years ago

Is this a dupe of #8880 ?

#7 Updated by Zach Hamman about 7 years ago

I am having the same issue with 1.4.1 with BetterGanttChart. Will not delete a project if an issue has a child.

/Users/zhamman/.gem/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/locking/optimistic.rb:127:in `destroy_without_habtm_shim_for_changesets'
(eval):4:in `destroy_without_callbacks'
/Users/zhamman/.gem/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/callbacks.rb:337:in `destroy_without_transactions'
/Users/zhamman/.gem/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/transactions.rb:229:in `send'
/Users/zhamman/.gem/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/transactions.rb:229:in `with_transaction_returning_status'
/Users/zhamman/.gem/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction'
/Users/zhamman/.gem/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/transactions.rb:182:in `transaction'
/Users/zhamman/.gem/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/transactions.rb:228:in `with_transaction_returning_status'
/Users/zhamman/.gem/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/transactions.rb:192:in `destroy'
/Users/zhamman/.gem/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/associations.rb:1430:in `has_many_dependent_destroy_for_issues'
/Users/zhamman/.gem/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/associations/association_collection.rb:392:in `method_missing'
/Users/zhamman/.gem/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/associations/association_proxy.rb:215:in `each'
/Users/zhamman/.gem/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/associations/association_proxy.rb:215:in `send'
/Users/zhamman/.gem/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/associations/association_proxy.rb:215:in `method_missing'
/Users/zhamman/.gem/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/associations/association_collection.rb:392:in `method_missing'
/Users/zhamman/.gem/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/associations.rb:1422:in `has_many_dependent_destroy_for_issues'
/Users/zhamman/.gem/ruby/1.8/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:178:in `send'
/Users/zhamman/.gem/ruby/1.8/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:178:in `evaluate_method'
/Users/zhamman/.gem/ruby/1.8/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:166:in `call'
/Users/zhamman/.gem/ruby/1.8/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:93:in `run'
/Users/zhamman/.gem/ruby/1.8/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:92:in `each'
/Users/zhamman/.gem/ruby/1.8/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:92:in `send'
/Users/zhamman/.gem/ruby/1.8/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:92:in `run'
/Users/zhamman/.gem/ruby/1.8/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:276:in `run_callbacks'
/Users/zhamman/.gem/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/callbacks.rb:344:in `callback_without_switch'
/Users/zhamman/Documents/redmine/vendor/plugins/redmine_better_gantt_chart/lib/redmine_better_gantt_chart/active_record/callback_extensions.rb:21:in `callback'
/Users/zhamman/.gem/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/callbacks.rb:336:in `destroy_without_transactions'
/Users/zhamman/.gem/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/transactions.rb:229:in `send'
/Users/zhamman/.gem/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/transactions.rb:229:in `with_transaction_returning_status'
/Users/zhamman/.gem/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction'
/Users/zhamman/.gem/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/transactions.rb:182:in `transaction'
/Users/zhamman/.gem/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/transactions.rb:228:in `with_transaction_returning_status'
/Users/zhamman/.gem/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/transactions.rb:192:in `destroy'
/Users/zhamman/Documents/redmine/app/controllers/projects_controller.rb:231:in `destroy'
/Users/zhamman/.gem/ruby/1.8/gems/actionpack-2.3.14/lib/action_controller/base.rb:1333:in `send'
/Users/zhamman/.gem/ruby/1.8/gems/actionpack-2.3.14/lib/action_controller/base.rb:1333:in `perform_action_without_filters'
/Users/zhamman/.gem/ruby/1.8/gems/actionpack-2.3.14/lib/action_controller/filters.rb:617:in `call_filters'
/Users/zhamman/.gem/ruby/1.8/gems/actionpack-2.3.14/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'
/Users/zhamman/.gem/ruby/1.8/gems/actionpack-2.3.14/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/Users/zhamman/.gem/ruby/1.8/gems/activesupport-2.3.14/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/Users/zhamman/.gem/ruby/1.8/gems/activesupport-2.3.14/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/Users/zhamman/.gem/ruby/1.8/gems/actionpack-2.3.14/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/Users/zhamman/.gem/ruby/1.8/gems/actionpack-2.3.14/lib/action_controller/rescue.rb:160:in `perform_action_without_flash'
/Users/zhamman/.gem/ruby/1.8/gems/actionpack-2.3.14/lib/action_controller/flash.rb:151:in `perform_action'
/Users/zhamman/.gem/ruby/1.8/gems/actionpack-2.3.14/lib/action_controller/base.rb:532:in `send'
/Users/zhamman/.gem/ruby/1.8/gems/actionpack-2.3.14/lib/action_controller/base.rb:532:in `process_without_filters'
/Users/zhamman/.gem/ruby/1.8/gems/actionpack-2.3.14/lib/action_controller/filters.rb:606:in `process'
/Users/zhamman/.gem/ruby/1.8/gems/actionpack-2.3.14/lib/action_controller/base.rb:391:in `process'
/Users/zhamman/.gem/ruby/1.8/gems/actionpack-2.3.14/lib/action_controller/base.rb:386:in `call'
/Users/zhamman/.gem/ruby/1.8/gems/actionpack-2.3.14/lib/action_controller/routing/route_set.rb:438:in `call'
/Users/zhamman/.gem/ruby/1.8/gems/actionpack-2.3.14/lib/action_controller/dispatcher.rb:87:in `dispatch'
/Users/zhamman/.gem/ruby/1.8/gems/actionpack-2.3.14/lib/action_controller/dispatcher.rb:121:in `_call'
/Users/zhamman/.gem/ruby/1.8/gems/actionpack-2.3.14/lib/action_controller/dispatcher.rb:130:in `build_middleware_stack'
/Users/zhamman/.gem/ruby/1.8/gems/actionpack-2.3.14/lib/action_controller/string_coercion.rb:25:in `call'
/Users/zhamman/.gem/ruby/1.8/gems/actionpack-2.3.14/lib/action_controller/string_coercion.rb:25:in `call'
/Users/zhamman/.gem/ruby/1.8/gems/rack-1.1.3/lib/rack/head.rb:9:in `call'
/Users/zhamman/.gem/ruby/1.8/gems/rack-1.1.3/lib/rack/methodoverride.rb:24:in `call'
/Users/zhamman/.gem/ruby/1.8/gems/actionpack-2.3.14/lib/action_controller/params_parser.rb:15:in `call'
/Users/zhamman/.gem/ruby/1.8/gems/actionpack-2.3.14/lib/action_controller/session/abstract_store.rb:177:in `call'
/Users/zhamman/.gem/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/query_cache.rb:29:in `call'
/Users/zhamman/.gem/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
/Users/zhamman/.gem/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/query_cache.rb:9:in `cache'
/Users/zhamman/.gem/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/query_cache.rb:28:in `call'
/Users/zhamman/.gem/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
/Users/zhamman/.gem/ruby/1.8/gems/actionpack-2.3.14/lib/action_controller/failsafe.rb:26:in `call'
/Users/zhamman/.gem/ruby/1.8/gems/rack-1.1.3/lib/rack/lock.rb:11:in `call'
/Users/zhamman/.gem/ruby/1.8/gems/rack-1.1.3/lib/rack/lock.rb:11:in `synchronize'
/Users/zhamman/.gem/ruby/1.8/gems/rack-1.1.3/lib/rack/lock.rb:11:in `call'
/Users/zhamman/.gem/ruby/1.8/gems/actionpack-2.3.14/lib/action_controller/dispatcher.rb:106:in `call'
/Users/zhamman/.gem/ruby/1.8/gems/rails-2.3.14/lib/rails/rack/static.rb:31:in `call'
/Users/zhamman/.gem/ruby/1.8/gems/rack-1.1.3/lib/rack/urlmap.rb:47:in `call'
/Users/zhamman/.gem/ruby/1.8/gems/rack-1.1.3/lib/rack/urlmap.rb:41:in `each'
/Users/zhamman/.gem/ruby/1.8/gems/rack-1.1.3/lib/rack/urlmap.rb:41:in `call'
/Users/zhamman/.gem/ruby/1.8/gems/rails-2.3.14/lib/rails/rack/log_tailer.rb:17:in `call'
/Users/zhamman/.gem/ruby/1.8/gems/rack-1.1.3/lib/rack/content_length.rb:13:in `call'
/Users/zhamman/.gem/ruby/1.8/gems/rack-1.1.3/lib/rack/chunked.rb:15:in `call'
/Users/zhamman/.gem/ruby/1.8/gems/rack-1.1.3/lib/rack/handler/mongrel.rb:67:in `process'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `process_client'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run'
/Users/zhamman/.gem/ruby/1.8/gems/rack-1.1.3/lib/rack/handler/mongrel.rb:38:in `run'
/Users/zhamman/.gem/ruby/1.8/gems/rails-2.3.14/lib/commands/server.rb:111
script/server:3:in `require'
script/server:3
/Users/zhamman/.gem/ruby/1.8/gems/ruby-debug-ide-0.4.16/lib/ruby-debug-ide.rb:112:in `debug_load'
/Users/zhamman/.gem/ruby/1.8/gems/ruby-debug-ide-0.4.16/lib/ruby-debug-ide.rb:112:in `debug_program'
/Users/zhamman/.gem/ruby/1.8/gems/ruby-debug-ide-0.4.16/bin/rdebug-ide:87
/Users/zhamman/.gem/ruby/1.8/bin/rdebug-ide:19:in `load'
/Users/zhamman/.gem/ruby/1.8/bin/rdebug-ide:19

#8 Updated by Zach Hamman about 7 years ago

Duplicates #11185?

#9 Updated by Go MAEDA about 1 year ago

  • Status changed from New to Closed
  • Resolution set to Cant reproduce

Since Redmine 1.2.0 is too old, I am closing this issue. Please open a new issue the problem still persists in the latest version of Redmine.

Also available in: Atom PDF