Extremely low connection to bucket on localhost

Hi,

I’m developing locally with Community Edition 5.1.1 build 5723 for a while (almost a year).
and ottoman (sdk).

recently I’m having trouble with my nodejs server to start since the connection to cb is extremely slow.
we’re talking about more than a minute (and more) to open a bucket on localhost.
from
couchbaseExt.openBucket
to
bucket.once(‘connect’, function (callback) {
})

when I use the UI at http://127.0.0.1:8091/ everything seems to be working well.

I already tried to restart it but it keeps coming back.
Any suggestions? I’m pretty helpless, the next step is to delete it altogether and re install.

Thanks

Hey @dor272,
Can you provide a bit more of your code demonstrating how you open the connection, and then proceed to use that connection? Something quick to try would be to use couchbase://127.0.0.1 as opposed to couchbase://localhost in your connection string, sometimes DNS can get in the way and slow things down.
Cheers, Brett

Hi @brett19,
I’m already using couchbase://127.0.0.1:

    ottoman.re.bucket = couchbaseExt.openBucket(apiCluster, config.db.bucket);
ottoman.re.bucket.on('error', console.error.bind(console, 'Couchbase connection error:'));

where config.db.bucket = ‘couchbase://127.0.0.1’

Hey @dor272,
Can you enable logging by specify LCB_LOGLEVEL=7 in your environment before starting your application? This should cause libcouchbase to emit a substantial amount of logging information which will be helpful to diagnosing the slow connect.
Cheers, Brett

@brett19
here is what I got until it connect:

0ms [I00002771] {5616} [INFO] (instance - L:469) Version=2.9.5-njs, Changeset=2bf296af07b40e1b0163f900c4f8bf388ae4e8a3

0ms [I00002771] {5616} [INFO] (instance - L:470) Effective connection string: couchbase://127.0.0.1/bucket?enable_errmap=true&enable_tracing=true&client_string=couchnode%2F2.6.6%20(node%2F11.4.0%3B%20v8%2F7.0.276.38-node.13%3B%20ssl%2F1.1.0j). Bucket=bucket
0ms [I00002771] {5616} [DEBUG] (instance - L:318) Applying initial cntl enable_errmap=true
0ms [I00002771] {5616} [DEBUG] (instance - L:318) Applying initial cntl enable_tracing=true
0ms [I00002771] {5616} [DEBUG] (instance - L:318) Applying initial cntl client_string=couchnode/2.6.6 (node/11.4.0; v8/7.0.276.38-node.13; ssl/1.1.0j)
0ms [I00002771] {5616} [INFO] (instance - L:146) DNS SRV lookup failed: DNS/Hostname lookup failed. Ignore this if not relying on DNS SRV records
0ms [I00002771] {5616} [DEBUG] (instance - L:83) Adding host 127.0.0.1:8091 to initial HTTP bootstrap list
0ms [I00002771] {5616} [DEBUG] (instance - L:83) Adding host 127.0.0.1:11210 to initial CCCP bootstrap list
0ms [I00002771] {5616} [TRACE] (instance - L:126) Bootstrap hosts loaded (cccp:1, http:1)
4029ms [I00002771] {5616} [INFO] (bootstrap - L:218) Requested network configuration: heuristic
4029ms [I00002771] {5616} [DEBUG] (confmon - L:87) Preparing providers (this may be called multiple times)
4029ms [I00002771] {5616} [DEBUG] (confmon - L:94) Provider CCCP is ENABLED
4029ms [I00002771] {5616} [DEBUG] (confmon - L:94) Provider HTTP is ENABLED
4029ms [I00002771] {5616} [TRACE] (confmon - L:277) Refreshing current cluster map
4034ms [I00002771] {5616} [TRACE] (confmon - L:264) Attempting to retrieve cluster map via CCCP
4034ms [I00002771] {5616} [INFO] (cccp - L:151) Requesting connection to node 127.0.0.1:11210 for CCCP configuration
4034ms [I00002771] {5616} [DEBUG] (lcbio_mgr - L:448) <127.0.0.1:11210> (HE=000001CE3515C5D0) Creating new connection because none are available in the pool
4034ms [I00002771] {5616} [TRACE] (lcbio_mgr - L:359) <127.0.0.1:11210> (HE=000001CE3515C5D0) New pool entry: I=000001CE31B91EA0
4034ms [I00002771] {5616} [INFO] (connection - L:474) <127.0.0.1:11210> (SOCK=00000000000014a6) Starting. Timeout=2000000us
4038ms [I00002771] {5616} [TRACE] (connection - L:367) <127.0.0.1:11210> (SOCK=00000000000014a6) Received completion handler. Status=0. errno=0 [No error]
4038ms [I00002771] {5616} [INFO] (connection - L:147) <127.0.0.1:11210> (SOCK=00000000000014a6) Connected established
4038ms [I00002771] {5616} [WARN] (lcbio - L:112) Translating errno=0, lcb=0x2d to NETWORK_ERROR
4038ms [I00002771] {5616} [INFO] (connection - L:108) <127.0.0.1:11210> (SOCK=00000000000014a6) Couldn’t set TCP_NODELAY
4038ms [I00002771] {5616} [DEBUG] (connection - L:106) <127.0.0.1:11210> (SOCK=00000000000014a6) Successfully set TCP_KEEPALIVE
4038ms [I00002771] {5616} [DEBUG] (lcbio_mgr - L:318) <127.0.0.1:11210> (HE=000001CE3515C5D0) Received result for I=000001CE31B91EA0,C=0000000000000000; E=0x0
4038ms [I00002771] {5616} [DEBUG] (lcbio_mgr - L:278) <127.0.0.1:11210> (HE=000001CE3515C5D0) Assigning R=000001CE31B90AC0 SOCKET=000001CE3376B7C0
4038ms [I00002771] {5616} [DEBUG] (ioctx - L:101) <127.0.0.1:11210> (CTX=000001CE33349B90,unknown) Pairing with SOCK=00000000000014a6
4038ms [I00002771] {5616} [DEBUG] (negotiation - L:440) <127.0.0.1:11210> (CTX=000001CE33349B90,sasl,SASLREQ=000001CE32AEE450) HELO identificator: {“a”:“libcouchbase/2.9.5-njs couchnode/2.6.6 (node/11.4.0; v8/7.0.276.38-node.13; ssl/1.1.0j)”,“i”:“0000000000002771/00000000000014a6”}, features: 0x02 (TLS), 0x06 (XATTR), 0x0b (JSON), 0x08 (Select bucket), 0x07 (XERROR), 0x03 (TCP nodelay), 0x0a (Snappy), 0x0f (Tracing)
4069ms [I00002771] {5616} [DEBUG] (negotiation - L:473) <127.0.0.1:11210> (CTX=000001CE33349B90,sasl,SASLREQ=000001CE32AEE450) Server supports features: 0x06 (XATTR), 0x08 (Select bucket), 0x07 (XERROR), 0x03 (TCP nodelay)
4070ms [I00002771] {5616} [DEBUG] (negotiation - L:524) <127.0.0.1:11210> (CTX=000001CE33349B90,sasl,SASLREQ=000001CE32AEE450) Sending SELECT_BUCKET

today’s it behaves better, so not sure if you can see any thing unusual.

Thanks