When I try to delete users the whole site hangs, i.e. Drupal does not respond anymore. What can cause that?

The site does not have any special user profile modules installed.

There is only one custom (self made) module with a hook_user which switches on $op. The 'delete' case looks unsuspicious:

case 'delete':
    $sql = "DELETE FROM {mynewsletter_users} WHERE uid = %d";
    db_query($sql, $account->uid);

Doesn't look bad to me. Should not invoke a hook_user-circle.

The problem is gone all by itself. No idea what happened.

  • Check the recent logs and see if there's an error. It could be a database error, or possibly a php memory error. Is this on a local server or a hosted server? Mar 2, 2011 at 21:43
  • I am afraid to get the site hanging again. That's why I cannot check right now (need to wait for a time of less activity). The site is hosted on a remote server. Mar 2, 2011 at 21:46

2 Answers 2


For me, this has happened when there is a misconfiguration on hook_user in a custom module. Specifically, check all of your implementations of hook_user to make sure there are no functions that lead to additional calls for hook_user.

That is, if you have a module that calls foo_do_magic_to_user() under hook_user (or, some other function that hits hook_user), and foo_do_magic_to_user() calls user_save(), then you have an infinite loop on your hands.


If you're absolutely certain that it's not a hook_user loop, then there could be any number of module-associated hangups. These often involve external services that are non-responsive (e.g. sending a "Goodbye" email but sendmail (or equivalent) isn' set up properly).

In your shoes, I would try:

1) Disable all non-core modules and see if the problem persists. If this still happens with only core modules, then you might have a deeper and more fundamental issue (correct version of PHP?)

2) If not #1, then re-enable contrib modules one-by-one and see which one is causing the issue. Inspecting that module's hook_user should give you a good clue as to what the root issue is. Most likely, one of the modules is calling some other service that is non-responsive.

  • Updated the question... Mar 3, 2011 at 13:24

The very first thing I'd do is to set up a local VM with a replica of the live server for local testing. Ideally this would be a copy made with dd or similar.

See if anything is implementing hook_user. For D5-D6 sites I use a recursive grep (using ack) from the site root to locate these. Remove this code and see if the site still hangs.

Use the MySQL Slow Query Log to see if it has any hints. Use ps and top to see what's actually happening on the web server.

I don't think that D5 has locking (D6 has lock_acquire in lock.inc)

It would also help if you could explain how you manage to recover the server once it's /locked/.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.