I am working on a custom module and added a 'Logout' link in the menu of the module. When I hit the logout link, instead of getting back to the user login page or 'Access Denied' page, I am getting a 'too many redirects' error in the browser and the website becomes unusable from that point unless I remove my module code from the Drupal installation directory.
I am wondering why is it getting into a redirect loop. After I hit the logout link, the user's session is destroyed it gets redirected to the same page. Since there is no user session now, it should atleast give me the 'Access Denied' page. Can anyone shed some light and give me pointers on why this could be happening?