question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

no living connections

See original GitHub issue
var elasticsearch = require('elasticsearch');
var client = new elasticsearch.Client({
host: 'http://id:pwd@host:port/',
log: 'trace',
});

client.search({
    index: 'index',
    type: 'type',
    body:{
        query:{
            match:{
                body:'timeout'
            }
        }
    }
}).then(function (resp) {
    var hits = resp.hits.hits;
    console.log("matching cases:"+resp.hits.hits.length);
}, function (err) {
    console.trace(err.message);
});

I was trying to test elasticsearch module with code above, and it worked at first but after trying several times, I got following error message.

Elasticsearch ERROR: 2014-04-24T02:55:19Z
Error: Request error, retrying -- connect ECONNREFUSED
at Log.error (C:\Users\Administrator\IdeaProjects\empty\nodejstest\node_modules\elasticsearch\src\lib\log.js:213:60)
at checkRespForFailure (C:\Users\Administrator\IdeaProjects\empty\nodejstest\node_modules\elasticsearch\src\lib\transport.js:187:18)
at HttpConnector.<anonymous> (C:\Users\Administrator\IdeaProjects\empty\nodejstest\node_modules\elasticsearch\src\lib\connectors\http.js:145:7)
at ClientRequest.bound (C:\Users\Administrator\IdeaProjects\empty\nodejstest\node_modules\elasticsearch\node_modules\lodash-node\modern\internals\baseBind.js:56:17)
at ClientRequest.EventEmitter.emit (events.js:95:17)
at Socket.socketErrorListener (http.js:1547:9)
at Socket.EventEmitter.emit (events.js:95:17)
at net.js:440:14
at process._tickCallback (node.js:415:13)

Elasticsearch WARNING: 2014-04-24T02:55:19Z
Unable to revive connection: http://id:pwd@host:port/

    Elasticsearch WARNING: 2014-04-24T02:55:19Z
No living connections

Trace: No Living connections
at C:\Users\Administrator\IdeaProjects\empty\nodejstest\test.js:54:13
at tryCatch1 (C:\Users\Administrator\IdeaProjects\empty\nodejstest\node_modules\elasticsearch\node_modules\bluebird\js\main\util.js:63:19)
at Promise$_callHandler [as _callHandler] (C:\Users\Administrator\IdeaProjects\empty\nodejstest\node_modules\elasticsearch\node_modules\bluebird\js\main\promise.js:695:13)
at Promise$_settlePromiseFromHandler [as _settlePromiseFromHandler] (C:\Users\Administrator\IdeaProjects\empty\nodejstest\node_modules\elasticsearch\node_modules\bluebird\js\main\promise.js:711:18)
at Promise$_settlePromiseAt [as _settlePromiseAt] (C:\Users\Administrator\IdeaProjects\empty\nodejstest\node_modules\elasticsearch\node_modules\bluebird\js\main\promise.js:868:14)
at Promise$_settlePromises [as _settlePromises] (C:\Users\Administrator\IdeaProjects\empty\nodejstest\node_modules\elasticsearch\node_modules\bluebird\js\main\promise.js:1006:14)
at Promise$_rejectPromises [as _rejectPromises] (C:\Users\Administrator\IdeaProjects\empty\nodejstest\node_modules\elasticsearch\node_modules\bluebird\js\main\promise.js:999:10)
at Async$_consumeFunctionBuffer [as _consumeFunctionBuffer] (C:\Users\Administrator\IdeaProjects\empty\nodejstest\node_modules\elasticsearch\node_modules\bluebird\js\main\async.js:74:12)
at Async$consumeFunctionBuffer (C:\Users\Administrator\IdeaProjects\empty\nodejstest\node_modules\elasticsearch\node_modules\bluebird\js\main\async.js:37:14)
at process._tickCallback (node.js:415:13)

It never revives and also I cannot connect to my elasticsearch cluster through web browser with url “http://ip:port/_search” or something similar.

I think there maybe a problem with releasing connection, is there a solution?

Would be great if you can tell me how to restore elasticsearch in this situation without restarting process itself.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
amir-rahnamacommented, Mar 23, 2016

The problem in my case is that I can’t close the connection. I keep the connection for long because I have a crawler that persists to elastic. What should I do in that case?

1reaction
haadcodecommented, May 6, 2014

Hi all,

I came across the same error recently and wanted to share my observations.

I created the client with: var client = new elasticsearch.Client({ host: 'localhost:9200', log: 'trace' });

…and then did requests on an interval of 1 second. After some time, I always got “Error: Request error, retrying – connect ECONNREFUSED”.

I checked ES server with curl ping and it was always reachable.

I changed the host to IP (127.0.0.1:9200) instead and got a different error: “Request error, retrying – connect EMFILE” which is a nodejs error which, according to SO answer, “means that the OS is denying your program to open more files/sockets” (http://stackoverflow.com/questions/10355501/connect-emfile-error-in-node-js).

I then realised I never closed/released the client connection but always created a new one instead of re-using the existing client.

Not sure if this is actually a problem on elasticsearch-js side as to me it seems this problem arises from misusing the module. Hope this helps to narrow down the bug or someone stumbling here in the future.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"message":"No living connections","node_env":"production"
Go to your PC Environments. Create a new variable,with variable name Java_Home . The variable value should be java installation path. Make sure ......
Read more >
No Living Connections · Issue #196 · elastic/elasticsearch-js
I have this issue as well, but in my application is a rabbitmq consumer, and when I use NodeJS Cluster (for more concurrency),...
Read more >
No living connections when try to connect Elasticsearch.
Hi, when I try to use the flexmonster to connect Elasticsearch it pops up an error message and says no living connections, Please...
Read more >
No Living Connections - Kibana - Discuss the Elastic Stack
Hi i have an error. my system ES 7.1 Kibana 7.1 HTTPS my elasticsearch.yml # ---------------------------------- Network ...
Read more >
No living connections error trying to import 5 million row CSV
Say you have a node app that ingests CSV's into elasticsearch. You've tested it with CSV's up to 16k rows successfully but the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found