There is probably a timer on the server side to prevent hanging programs to hog resources indefinitely.
If you haven't written something that's supposed to run for a long time, then you indeed may have ended up in an endless loop. Try adding log messages and find out where your code hangs.
If you intended to write something that runs for a long time, you can try to put something on the standard output to see if that resets the timer and allows your code to run longer.
If you can share your code, please do, so we can give you a more specific answer.