Giter Club home page Giter Club logo

Comments (12)

spalger avatar spalger commented on May 22, 2024

I believe it is because of the keepAlive: false in your config. This is going to cause new connections to be created for each request, I suggest using keepAlive.

from elasticsearch-js.

Nomeasmo avatar Nomeasmo commented on May 22, 2024

Nope, I initially tried it with standard configuration. No difference with any keepAlive setting.

client = new elasticsearch.Client({
    host: 'localhost:9200',
});

from elasticsearch-js.

Nomeasmo avatar Nomeasmo commented on May 22, 2024

Using the bulk works pretty well.

from elasticsearch-js.

spalger avatar spalger commented on May 22, 2024

Yes, that's certainly a good idea if you have access to multiple requests at a time.

I'm almost certain that EADDRNOTAVAIL is directly related to opening and closing tcp sockets, but if you are not modifying the keepAlive/maxSockets/minSockets config then it should be opening 10 sockets and keeping them alive, no more, no less. As I walk through the forever-agent module I'm not sure that is the case. Do you have a script you can share that reproduces this?

from elasticsearch-js.

Nomeasmo avatar Nomeasmo commented on May 22, 2024

This small code does the job

var elasticsearch = require('elasticsearch'),
    async = require('async'),
    _ = require('underscore'),
    client;

client = new elasticsearch.Client({
    host: 'localhost:9200'
});

async.eachSeries(_.range(20000), function (value, done) {
    client.create({index: 'tests', type: 'test', body: {something: true, value: value}}, done);
});

from elasticsearch-js.

spalger avatar spalger commented on May 22, 2024

alright, I found the problem and submitted request/forever-agent#16. Working on a solution for the meantime.

from elasticsearch-js.

spalger avatar spalger commented on May 22, 2024

Version 1.5.10 includes a fix that should force forever-agent to use the connection pool for all requests. If you have time to confirm I would appreciate it.

from elasticsearch-js.

smithatlanta avatar smithatlanta commented on May 22, 2024

I'm using 1.5.11 and I'm still getting this error. Did it get reintroduced?

from elasticsearch-js.

spalger avatar spalger commented on May 22, 2024

Well, this is embarrassing. It looks like I didn't test the solution I committed and it didn't actually do what I thought it did, sorry about that.

Using @Nomeasmo's script I was able to reproduce the issue and create a verified fix. Creating a test case for this that can run automatically is pretty tricky, but it is on my todo list.

@smithatlanta or @Nomeasmo if either of you have time to verify that things are working for you too, I would really appreciate it.

https://gist.github.com/spenceralger/9550110

from elasticsearch-js.

smithatlanta avatar smithatlanta commented on May 22, 2024

That solved my issue. Loaded 1/4 of a million items with no issues. Thanks.

from elasticsearch-js.

spalger avatar spalger commented on May 22, 2024

Glad to hear.

from elasticsearch-js.

philberg avatar philberg commented on May 22, 2024

@spalger I am facing the exact same issue running OSX 10.10.2 , node v0.12.7, and ES 1.6.0

I am able to replicate the issue using the sample code from @Nomeasmo above. Could this issue needs to be resolved differently in 0.12 given the different http pooling?

from elasticsearch-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.