Defect #8880

Error deleting issue with grandchild

Added by Luis Serrano Aranda over 6 years ago. Updated about 6 years ago.

Status:ClosedStart date:2011-07-22
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Issues
Target version:1.2.2
Resolution:Fixed Affected version:1.2.1

Description

If I have three task level and I try to delete the parent task Redmine fails.
Task |---> Sub Task Level two |---> Sub Task level three
But if I delete the sub task Level two and after the parent Redmine works

I test without any plugin

The error is:

ActiveRecord::StaleObjectError in IssuesController#destroy

Attempted to delete a stale object: Issue
RAILS_ROOT: /var/www/redmine

Application Trace | Framework Trace | Full Trace
/var/www/redmine/vendor/rails/activerecord/lib/active_record/locking/optimistic.rb:127:in `destroy_without_habtm_shim_for_changesets'
(eval):4:in `destroy_without_callbacks'
/var/www/redmine/app/controllers/issues_controller.rb:245:in `destroy'
/var/www/redmine/app/controllers/issues_controller.rb:243:in `each'
/var/www/redmine/app/controllers/issues_controller.rb:243:in `destroy'
Request

Parameters:

{"authenticity_token"=>"sE0B1d6fC5kL0w6VIuAFYQqGxyyvk1MIkig5RP9wFT0=",
"id"=>"29374"}
Show session dump

Response

Headers:

{"Content-Type"=>"",
"Cache-Control"=>"no-cache"}

My environment is:

My system information

About your application's environment
Ruby version 1.8.7 (x86_64-linux)
RubyGems version 1.3.7
Rack version 1.1
Rails version 2.3.11
Active Record version 2.3.11
Active Resource version 2.3.11
Action Mailer version 2.3.11
Active Support version 2.3.11
Edge Rails revision unknown
Application root /var/www/redmine
Environment production
Database adapter mysql
Database schema version 20110511000000

Associated revisions

Revision 6311
Added by Jean-Philippe Lang over 6 years ago

Fixed: Error deleting issue with grandchild (#8880).

Revision 7769
Added by Jean-Philippe Lang about 6 years ago

Merged r6311 from trunk (#8880).

History

#1 Updated by Etienne Massip over 6 years ago

  • Target version set to Candidate for next minor release

Confirmed with pg on trunk and exact same stack trace.

#2 Updated by Jean-Philippe Lang over 6 years ago

  • Subject changed from Error deleting task to Error deleting issue with grandchild
  • Target version changed from Candidate for next minor release to 1.2.2

#3 Updated by Jean-Philippe Lang over 6 years ago

  • Status changed from New to Resolved
  • Resolution set to Fixed

Fixed in r6311.

#4 Updated by Luis Serrano Aranda about 6 years ago

Something very similar happens when you try to delete a project with a sub-task, this is the error

ActiveRecord::StaleObjectError in ProjectsController#destroy

Attempted to delete a stale object: Issue
RAILS_ROOT: /var/www/redmine

Application Trace | Framework Trace | Full Trace
/var/www/redmine/vendor/rails/activerecord/lib/active_record/locking/optimistic.rb:127:in `destroy_without_habtm_shim_for_changesets'
(eval):4:in `destroy_without_callbacks'
/var/www/redmine/app/controllers/projects_controller.rb:234:in `destroy'
Request

Parameters:

{"commit"=>"Borrar",
"confirm"=>"1",
"_method"=>"delete",
"authenticity_token"=>"yxOI1JHy7oGkYM9rD7T31LE08lhXuugfp5qztRwWLh8=",
"id"=>"testing"}
Show session dump

Response

Headers:

{"Content-Type"=>"",
"Cache-Control"=>"no-cache"}

#5 Updated by Etienne Massip about 6 years ago

Could you please attach here the relevant full stack trace you'll find in your production.log file?

#6 Updated by Luis Serrano Aranda about 6 years ago

Processing ProjectsController#destroy (for 127.0.0.1 at 2011-08-25 14:51:34) [GET]
Parameters: {"action"=>"destroy", "id"=>"plantoper", "controller"=>"projects"}
Rendering template within layouts/base
Rendering projects/destroy
Completed in 40ms (View: 36, DB: 0) | 200 OK [http://127.0.0.1/projects/plantoper/destroy]

Processing ProjectsController#destroy (for 127.0.0.1 at 2011-08-25 14:51:36) [DELETE]
Parameters: {"commit"=>"Borrar", "confirm"=>"1", "action"=>"destroy", "_method"=>"delete", "authenticity_token"=>"8SnFDMeQaBAt4QMsGsc1pegC/+eRsgIDQT45ArOlHR0=", "id"=>"plantoper", "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'
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start'

Rendering rescues/layout (conflict)

#7 Updated by Luis Serrano Aranda about 6 years ago

Without the revision 6311

Processing ProjectsController#destroy (for 127.0.0.1 at 2011-08-25 14:51:34) [GET]
Parameters: {"action"=>"destroy", "id"=>"plantoper", "controller"=>"projects"}
Rendering template within layouts/base
Rendering projects/destroy
Completed in 40ms (View: 36, DB: 0) | 200 OK [http://127.0.0.1/projects/plantoper/destroy]

Processing ProjectsController#destroy (for 127.0.0.1 at 2011-08-25 14:51:36) [DELETE]
Parameters: {"commit"=>"Borrar", "confirm"=>"1", "action"=>"destroy", "_method"=>"delete", "authenticity_token"=>"8SnFDMeQaBAt4QMsGsc1pegC/+eRsgIDQT45ArOlHR0=", "id"=>"plantoper", "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'
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start'

Rendering rescues/layout (conflict)

#8 Updated by Luis Serrano Aranda about 6 years ago

With the revision 6311

Processing ProjectsController#destroy (for 127.0.0.1 at 2011-08-25 14:54:26) [DELETE]
Parameters: {"commit"=>"Borrar", "confirm"=>"1", "action"=>"destroy", "_method"=>"delete", "authenticity_token"=>"8SnFDMeQaBAt4QMsGsc1pegC/+eRsgIDQT45ArOlHR0=", "id"=>"plantoper", "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'
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start'

Rendering rescues/layout (conflict)

#9 Updated by Luis Serrano Aranda about 6 years ago

The same log

#10 Updated by Jack Chiu about 6 years ago

I have same problem, but i solve it.

if sub_issue.create_time > parent_issue.create_time
project.destroy is Error ===========================================================================================
ActiveRecord::StaleObjectError: Attempted to delete a stale object: Issue
(eval):4:in `destroy_without_callbacks'
test/unit/project_test.rb:187:in `test_destroying_root_projects_should_clear_data'
test/unit/project_test.rb:186:in `test_destroying_root_projects_should_clear_data'

Change craete_time by fixture file.

Units passed.

#11 Updated by Etienne Massip about 6 years ago

Jack Chiu wrote:

I have same problem, but i solve it.

if sub_issue.create_time > parent_issue.create_time
project.destroy is Error ===========================================================================================
ActiveRecord::StaleObjectError: Attempted to delete a stale object: Issue
(eval):4:in `destroy_without_callbacks'
test/unit/project_test.rb:187:in `test_destroying_root_projects_should_clear_data'
test/unit/project_test.rb:186:in `test_destroying_root_projects_should_clear_data'

Change craete_time by fixture file.

Units passed.

Sorry, don't understand.

Do you mean that if you change create time in fixture file, test_destroying_root_projects_should_clear_data will fail?

How did you solve it?

#12 Updated by Jean-Philippe Lang about 6 years ago

  • Status changed from Resolved to Closed

Merged in r7769.
If an error occurs in an other use case, please open a new ticket, thanks.

Also available in: Atom PDF