doctrine / couchdb-client

CouchDB Client library
MIT License
122 stars 68 forks source link

Got problems with connection #62

Closed dragonito closed 8 years ago

dragonito commented 8 years ago

Hi there,

perhaps someone could help me, got this message while connection to couchdb (on Symfony 3.x):

Could not connect to server at xxx.xxx.xxx.xxx:5984: '60: Operation timed out

in one of my older projects from august 2015 the connection works well. (Symfony 2.x)

I only use the client not the odm bundle. I use the same network and the same machine.

Whats the best way to get more informations about this error? Operation timed out could be everything.

Thanks a lot

Robin

chadbean commented 8 years ago

@dragonito I had the same issue. I noticed that the default timeout value for the CouchDBClient::create static method is only "0.01". After increasing this value, I no longer experience this issue. You can increase it like this:

                  $couchClient = CouchDBClient::create([
                        'dbname' => self::COUCHDB_DBNAME,
                        'user' => self::COUCHDB_USER,
                        'password' => self::COUCHDB_PASS,
                        'host' => self::COUCHDB_HOST,
                        'port' => self::COUCHDB_PORT,
                        'timeout' => 1,
                        'ssl' => true,
                    ]);

A value of "0.01" might be perfect for a local CouchDB instance, but could be too low if the instance is hosted on a separate network, e.g. Cloudant. I might suggest increasing this in the client.

Aside: let me know if I should submit a PR for this change and if a timeout default of "1" would be preferred.

beberlei commented 8 years ago

We increased the default timeout to 10 seconds for now.

11mb commented 6 years ago

When using odm the default still is 0.01 . Be alert to add the timeout in your configuration:

doctrine_couch_db:
    client:
        connections:
            name:
                dbname: 'db_name'
                ip: '%couchdb_host%'
                user: '%couchdb_user%'
                password: '%couchdb_password%'
                timeout: 10