Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Internals] Dependent instances leaking #1400

Closed
dnrce opened this issue Jun 25, 2014 · 3 comments
Closed

[Internals] Dependent instances leaking #1400

dnrce opened this issue Jun 25, 2014 · 3 comments
Labels
bug 🐛 Problems with the code that result in unexpected or bad behavior Database Problems related to the database
Milestone

Comments

@dnrce
Copy link
Member

dnrce commented Jun 25, 2014

Migrated from the original issue at https://www.assembla.com/spaces/tracks-tickets/tickets/1400

After destroying a Context or Project, all related Todos are deleted as a consequence of :dependent => :delete_all. However, the deletion of Todos done this way does not propagate deletion to associated Dependents. This is because :delete_all deletes all related Todo objects without executing callbacks; therefore the :dependent option of Todo.successor_dependencies and Todo.predecessor_dependencies is ignored. As a result, the database gets polluted with Dependency objects that have successor or predecessor associations as null.

This does not change the behavior of the application in any way. Having leaks in the database does affect performance and footprint, though.

Suggested fix: User.todos and Project.todos associations would have to be :dependent => :destroy_all. This change would only affect the successor_dependencies and predecessor_dependencies associations, making sure no Dependent object is left behind when a Todo is deleted as a corollary of destroying a User or a Project.

Thanks,

  • Ivan

Originally reported by Bocete on February 2, 2013 at 22:59:01 (+0000) against version git-devel

@dnrce dnrce added this to the 2.2.3 milestone Jun 25, 2014
@dnrce
Copy link
Member Author

dnrce commented Jun 25, 2014

On February 2, 2013 at 12:34:22 (+0000), lrbalt commented:

good catch! IIRC it was changed from destroy to delete, but I don't remember why...

We then need a migration too to return the leaked todos to active state.

@dnrce
Copy link
Member Author

dnrce commented Sep 8, 2014

This is too deep a change for a patch release. Moving to 2.3.

@dnrce dnrce modified the milestones: 2.3, 2.2.3 Sep 8, 2014
@lrbalt
Copy link
Member

lrbalt commented Sep 23, 2014

I think the same goes for tags places on todos. The taggings linked to the removed todo should be deleted too

@lrbalt lrbalt closed this as completed in 18b7a46 Sep 23, 2014
errinlarsen added a commit to errinlarsen/tracks that referenced this issue Dec 24, 2014
* upgrade_irkeninvader.net: (570 commits)
  [v2.3.rc1] add postgresql & bundle install
  [v2.3.rc1] add vendor/bundle to .gitignore
  Version 2.3.rc1
  Add pessimistic version constraints for all gems
  Use badges targeting 2.3_branch
  Fix links on same line
  Specify pages for MkDocs
  Minor changelog polish
  Convert changelog to Markdown
  Recommend upgrading from 2.2.3
  Pull changelog entry from Tracks 2.2.3
  Remove metadata from top of changelog
  Update rspec-expectations gem
  Update capybara gem
  Update codeclimate-test-reporter gem
  Use latest Tolk from Rubygems
  fix TracksApp#1400 where deleting a user will clean up tags and dependencies too
  add test for deleting all stuff of a user when this users is deleted. Fixes TracksApp#1447
  create secrets.yml per rails upgrade instructions. It uses the secret key from site.yml
  make drag_action_title unambiguous
  ...

Resolved Conflicts:
	.gitignore
	.travis.yml
	Gemfile
	Gemfile.lock
	README.md
	app/assets/javascripts/tracks.js.erb
	app/controllers/contexts_controller.rb
	app/controllers/data_controller.rb
	app/controllers/integrations_controller.rb
	app/controllers/projects_controller.rb
	app/controllers/recurring_todos_controller.rb
	app/controllers/todos_controller.rb
	app/helpers/todos_helper.rb
	app/models/message_gateway.rb
	app/models/project.rb
	app/models/recurring_todo.rb
	app/models/todo.rb
	app/views/contexts/create.js.erb
	app/views/projects/update.js.erb
	app/views/projects/update_project_name.js.erb
	app/views/todos/_successor.html.erb
	app/views/todos/create.js.erb
	app/views/todos/update.js.erb
	config/application.rb
	config/initializers/secret_token.rb
	config/initializers/tracks.rb
	config/locales/es.yml
	config/locales/fr.yml
	config/routes.rb
	config/site.yml.tmpl
	db/tracks-blank.sqlite3.db
	db/tracks-example.sqlite3.db
	db/tracks-test.sqlite3.db
	doc/CHANGELOG.md
	features/context_list.feature
	features/manage_users.feature
	features/step_definitions/context_list_steps.rb
	features/step_definitions/project_list_steps.rb
	features/step_definitions/project_steps.rb
	features/step_definitions/todo_edit_steps.rb
	features/step_definitions/todo_steps.rb
	features/support/world.rb
	features/tickler.feature
	lib/tracks/done_todos.rb
	test/controllers/stats_controller_test.rb
	test/controllers/todos_controller_test.rb
	test/functional/recurring_todos_controller_test.rb
	test/models/project_test.rb
	test/unit/tagging_test.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Problems with the code that result in unexpected or bad behavior Database Problems related to the database
Projects
None yet
Development

No branches or pull requests

2 participants