If an exception does occur here due to server shutdown, won't the following while loop run infinitely?