Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@desktable
Copy link

Occasionally Pymongo would enter an infinite loop in the GridOut.read() function.

The loop is as following:

        while received < size:
            chunk_data = self.readchunk()
            received += len(chunk_data)
            data.write(chunk_data)

If self.readchunk() returns an empty string, received will not be incremented, and thus the program will stuck in this loop forever. This will happen if the grid files are corrupt, with their actual total chunk size smaller than the size claimed in the metadata. This pull request raises a CorruptGridFile error when an empty chunk is read, allowing Pymongo to escape the infinite loop.

@behackett
Copy link
Member

Thanks for reporting this. I've opened PYTHON-951 to track a fix.

@desktable
Copy link
Author

Thanks.

@behackett
Copy link
Member

I've pushed a slightly different fix for this problem to both master and v2.9. The same problem exists in GridOut.readline, so the fix actually has to go in readchunk. Thanks again for the report.

@behackett behackett closed this Jun 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.