1

The program is being developed in Python. It contains lots of queries to a remote CouchDB database. The program begins to run and after a while, it is just freezes up. When I check the connection, I observe that the CouchDB database connection has been lost. It still uses the CPU without doing anything (it it seems so).

def addNewDnsRecord(self, record):
     if self.checkHashValue(record['hashValue']):
         ....                                #some code to generate an id
         record['_id'] = tempid
         self.bulk.append(record)            #add record at the end of the bulk

         if len(self.bulk) == 1000:          #bulk with 1000 records are inserted
              self.dns_db.update(self.bulk)
              self.bulk = []

def checkHashValue(self, hashValue):
    result = self.dns_db.view('records/hashcheck', None, key=hashValue)
    if len(result) == 0:
          return True
    else:
          return False

Secondly, is there a way to check whether connection is established or lost in CouchDB-python.

What may be the reason of connection loss?

smathy
  • 26,283
  • 5
  • 48
  • 68
Shnkc
  • 2,108
  • 1
  • 27
  • 35
  • 1
    CouchDB doesn't have stateful connections, it's just single requests to the HTTP/REST API, so this is not a CouchDB problem at all - it's your python lib that's doing some sort of connection caching. So, I replaced the `couchdb` tag with `couchdb-python` one. – smathy Jul 21 '12 at 22:07
  • Agree that this sounds like more of a problem with couchdb-python. Would be great to see an answer end up back here when you figure it out, but you might try http://code.google.com/p/couchdb-python/issues/list or their mailinglist if this is still a bug. – natevw Jan 16 '13 at 18:51

0 Answers0