Project

General

Profile

Actions

Defect #7904

closed

Subprojects not properly deleted when deleting a parent project

Added by Tom Skerry almost 14 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
High
Assignee:
-
Category:
Projects
Target version:
Start date:
2011-03-17
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

Redmine version details:
Redmine version 1.1.1
Ruby version 1.8.7 (i386-mingw32)
RubyGems version 1.5.2
Rack version 1.0
Rails version 2.3.5
Active Record version 2.3.5
Active Resource version 2.3.5
Action Mailer version 2.3.5
Active Support version 2.3.5
Application root D:/Program Files (x86)/Redmine_Webserver/Redmine
Environment development
Database adapter mysql
Database schema version 0

Cause of bug:
1) Added 10 new projects to our internal Redmine system as sub-projects of another new "parent" project.
2) Deleted parent project containing the 10 new projects. This asks if sure as will delete all sub-projects. Clicked OK, all projects removed successfully.
3) Tried to add new project. On clicking "save" button received 500 internal server error page.
4) Production.log reported:

Processing ProjectsController#create (for 10.1.21.56 at 2011-03-17 11:36:50) [POST]
Parameters: {"commit"=>"Save", "action"=>"create", "authenticity_token"=>"ajshQQHoNa6r2vokeJqZI5HWMpr+TWvFPTLFbmOtyp0=", "project"=>{"name"=>"Code Reviewer", "tracker_ids"=>["1", "2", "3", ""], "homepage"=>"", "parent_id"=>"21", "is_public"=>"1", "description"=>"A web based tool for reviewing code", "identifier"=>"codereviewer", "enabled_module_names"=>["wiki", ""]}, "controller"=>"projects"}

ActiveRecord::StatementInvalid (Mysql::Error: Duplicate entry '25-1' for key 'projects_trackers_unique': INSERT INTO `projects_trackers` (`project_id`, `tracker_id`) VALUES (25, 1)):
app/controllers/projects_controller.rb:78:in `create'

Rendering D:/Program Files (x86)/Redmine_Webserver/Redmine/public/500.html (500 Internal Server Error)

Reason:
Within the projects_trackers table the project_id "25" was already populated. As were "26" through "35". It would appear these weren't cleared out when the previous projects were deleted, either that or the project_id counter was decremented when it shouldn't have been.

Temporary Fix:
Every time a project is created and the 500 internal error screen appears the project_id still gets incremented. Therefore if you try enough times (in my case 10 or 11 times), the project_id will be incremented to a free unique number and the project will save successfully (no 500 screen). The system will then behave itself until more things are deleted in a similar manor. Moral of the story, if it wont save a new project, keep trying until it does!


Related issues

Related to Redmine - Defect #7385: Error when viewing an issue which was related to a deleted subtaskClosedJean-Philippe Lang2011-01-20

Actions
Actions

Also available in: Atom PDF