A point to note that happened to me is that the GeneratorExit exception is not thrown when you are using flask in a development server and not in production (something to do with wsgi but i don't know why exactly there is this difference). So when you close an event stream from the client side flask will not stop the generator from generating in a development server.