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

Unable to delete a user, causes all subsequent db requests to fail #7137

Closed
kevinansfield opened this issue Jul 25, 2016 · 2 comments · Fixed by #7145
Closed

Unable to delete a user, causes all subsequent db requests to fail #7137

kevinansfield opened this issue Jul 25, 2016 · 2 comments · Fixed by #7145
Labels
bug [triage] something behaving unexpectedly server / core Issues relating to the server or core of Ghost

Comments

@kevinansfield
Copy link
Contributor

kevinansfield commented Jul 25, 2016

Issue Summary

When attempting to delete a user who has posts I'm seeing a 500 Internal Server Error, all subsequent API requests also return a 500 error.

Steps to Reproduce

  1. Ensure you have a user who has authored some posts
  2. Sign out and sign in as a user who has permissions to delete users
  3. Select the user from step 1 in the Team page then click the cog icon and select "Delete User"
  4. Click "Delete"

At this point I see a long spinner which eventually results in the 500 error and this message in the app log:

ERROR: Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx) call? 

 InternalServerError: Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx) call?
    at Error.InternalServerError (/Users/kevinansfield/code/ghost/Ghost/core/server/errors/internal-server-error.js:6:18)
    at null.<anonymous> (/Users/kevinansfield/code/ghost/Ghost/core/server/models/post.js:661:23)
From previous event:
    at Function.destroyByAuthor (/Users/kevinansfield/code/ghost/Ghost/core/server/models/post.js:660:19)
    at Function.tryCatcher (/Users/kevinansfield/code/ghost/Ghost/node_modules/bluebird/js/release/util.js:16:23)
    at Function.destroyByAuthor (/Users/kevinansfield/code/ghost/Ghost/node_modules/bluebird/js/release/method.js:15:34)
    at /Users/kevinansfield/code/ghost/Ghost/core/server/api/users.js:397:39
    at /Users/kevinansfield/code/ghost/Ghost/node_modules/knex/lib/transaction.js:38:20
    at processImmediate [as _immediateCallback] (timers.js:383:17) 

DELETE /ghost/api/v0.1/users/7/ 500 60093.195 ms - 167

Any requests after this point have a similar response.

In case it's particular to my database state, here's a copy of my sqlite db

Technical details:

  • Ghost Version: master
  • Database: sqlite
@kevinansfield kevinansfield added bug [triage] something behaving unexpectedly p1:priority [triage] Priority for immediate patch release labels Jul 25, 2016
@kirrg001
Copy link
Contributor

This bug exists also in 0.8.0.

@kirrg001
Copy link
Contributor

The bug only exists when using sqlite.

@kevinansfield kevinansfield added server / core Issues relating to the server or core of Ghost and removed p1:priority [triage] Priority for immediate patch release labels Jul 25, 2016
@kirrg001 kirrg001 modified the milestone: 0.9.1 Aug 11, 2016
kirrg001 added a commit to kirrg001/Ghost that referenced this issue Sep 19, 2016
closes TryGhost#7137

- fix destroying event for post
ErisDS pushed a commit that referenced this issue Sep 19, 2016
closes #7137

Deleting the content from the database runs in a transaction. see
https://github.com/TryGhost/Ghost/blob/master/core/server/api/users.js#L390

`destroyByAuthor` is one of the operations we trigger to delete all the conent, see https://github.com/TryGhost/Ghost/blob/master/core/server/models/post.js#L647

The post model has a specific hook for deleting content to delete the relations as well, see https://github.com/TryGhost/Ghost/blob/master/core/server/models/post.js#L122

This hook is part of the transaction. But the `options` are ignored. `(model/*, attr, options*/)` 
We use the `options` to forward the transaction reference, which we need to pass into the bookshelf queries. So `return model.load('tags').call('related', 'tags').call('detach')` does not forward the transaction and that's why it stucks when deleting the content.
yo1dog pushed a commit to yo1dog/Ghost that referenced this issue Oct 14, 2016
closes TryGhost#7137

Deleting the content from the database runs in a transaction. see
https://github.com/TryGhost/Ghost/blob/master/core/server/api/users.js#L390

`destroyByAuthor` is one of the operations we trigger to delete all the conent, see https://github.com/TryGhost/Ghost/blob/master/core/server/models/post.js#L647

The post model has a specific hook for deleting content to delete the relations as well, see https://github.com/TryGhost/Ghost/blob/master/core/server/models/post.js#L122

This hook is part of the transaction. But the `options` are ignored. `(model/*, attr, options*/)` 
We use the `options` to forward the transaction reference, which we need to pass into the bookshelf queries. So `return model.load('tags').call('related', 'tags').call('detach')` does not forward the transaction and that's why it stucks when deleting the content.
mixonic pushed a commit to mixonic/Ghost that referenced this issue Oct 28, 2016
closes TryGhost#7137

Deleting the content from the database runs in a transaction. see
https://github.com/TryGhost/Ghost/blob/master/core/server/api/users.js#L390

`destroyByAuthor` is one of the operations we trigger to delete all the conent, see https://github.com/TryGhost/Ghost/blob/master/core/server/models/post.js#L647

The post model has a specific hook for deleting content to delete the relations as well, see https://github.com/TryGhost/Ghost/blob/master/core/server/models/post.js#L122

This hook is part of the transaction. But the `options` are ignored. `(model/*, attr, options*/)` 
We use the `options` to forward the transaction reference, which we need to pass into the bookshelf queries. So `return model.load('tags').call('related', 'tags').call('detach')` does not forward the transaction and that's why it stucks when deleting the content.
geekhuyang pushed a commit to geekhuyang/Ghost that referenced this issue Nov 20, 2016
closes TryGhost#7137

Deleting the content from the database runs in a transaction. see
https://github.com/TryGhost/Ghost/blob/master/core/server/api/users.js#L390

`destroyByAuthor` is one of the operations we trigger to delete all the conent, see https://github.com/TryGhost/Ghost/blob/master/core/server/models/post.js#L647

The post model has a specific hook for deleting content to delete the relations as well, see https://github.com/TryGhost/Ghost/blob/master/core/server/models/post.js#L122

This hook is part of the transaction. But the `options` are ignored. `(model/*, attr, options*/)` 
We use the `options` to forward the transaction reference, which we need to pass into the bookshelf queries. So `return model.load('tags').call('related', 'tags').call('detach')` does not forward the transaction and that's why it stucks when deleting the content.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug [triage] something behaving unexpectedly server / core Issues relating to the server or core of Ghost
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants