Running Error - Robot is not stopping, forcing a stop
I don't see any clear problems with that code there. The only way I could see it looping forever is if either setMarked and isMarked are not working correctly, or some other code being called is unsetting the marks in the middle of that loop.
It is possible that this search is just plain taking far too long (>533ms on your computer) because of there being too many nodes to search before it finds the desired end point. How many nodes are you running this code with? If this is indeed the case, you should do one or both of the following: 1) Reduce the number of nodes, and/or 2) Switch from a full breadth first search to a more efficient algorithm such as A*
To figure out what the problem is, I would tend to suggest running this under a debugger, and step through what is happening.
EDIT: Oh, and another possible thing that comes to mind, is perhaps your problem has nothing to do with your node search code. Maybe your robot is just never calling any of the methods that signal to Robocode that has finished it's turn.