The loop is intented but you should not get stuck. It should be a one way loop, where you can walk infinitly in one direction but if you go back you will soon find yourself in the room you came from.
If a door does not have a valid exit on one key it will bring you back to this special room.