I am using tailable cursors to read a capped collection as it get written:
It works fine most of the time, however I noticed a problem happening randomly. Sometimes, if I shut down the MongoDB server, the cursor doesn't detect the disconnection, and stays in an endless loop without raising any error.
I think the problem may be in cursor.py. In refresh, self._id appears to be 0, so the "elif self._id" statement is skipped, and the cursor doesn't try to get more data from the server, so no error is ever raised.