robbrit
robbrit

Reputation: 17960

pymongo: "OperationFailure: database error: error querying server"

We're occasionally getting the following error when doing queries:

OperationFailure: database error: error querying server

There is no specific query causing this, and when repeating the process things work. Has anybody else seen this error?

Our setup is a cluster of Ubuntu VMs on Amazon EC2, we're using Python 2.7.3 and pymongo v2.3. We're also using Mongoengine, however we still get this exception from non-Mongoengine code.

Upvotes: 7

Views: 1883

Answers (2)

robbrit
robbrit

Reputation: 17960

To those discovering this question:

We were never able to fully diagnose the problem with this, our hunch is that the database connection tends to fail every once in a while for whatever reason. From our research into distributed computing, this is a common problem and needs to be handled explicitly.

In the end, we adapted our system to become robust to DB connection failures by catching OperationFailure exceptions along with similar ones and re-establishing the database connection. This resolved the problem along with a number of similar ones we were having.

Upvotes: 4

Ross
Ross

Reputation: 18101

Seems the query failed on the server - to diagnose you'd need to check the server logs.

Upvotes: 0

Related Questions