Hi
This is now fixed, but I'm posting this in case anybody else runs into the same problem.
My site was working fine, but suddenly stopped allowing me to login. Pages would still be displayed OK if you were not logged in, but as soon as you tried to login you would get a timeout message (after 120 seconds) for any page you ried to view. This applied to whichever account you tried to login with, including the administrator account.
The error message referred to /includes/menu.inc line 738. On checking this file, I found the line is in the middle of the menu_sort function ("comparator routine for use in sorting menu items"), so I used PHPMyAdmin to look at the menu table. I discovered this had many duplicated records for 'book', 'poll' and 'search' (about 600 of each). After deleting the extra records I was able to login as normal.
I'm not clear why these duplicate records should have appeared but I have done quite a bit of work on the menu system and url aliases which I assume had something to do with it - I'd have several tabs open for creating menu items so that I didn't have to wait for one to be added before I could start setting up the next. I'm not sure why it should have been 'book', 'poll' and 'search' that should have been repeated though.
Glad it's working OK now, but I think this shows one of the advantages of open source software in that if drupal was proprietary I'd never have been able to examine the code and find out what was going wrong.