neo4j-javascript-driver: Queries will hang arbitrarily

const getOneResult = transaction => {
    const session = driver.session();

    return session.run(transaction)
        .then(result => {

            session.close();
            return result;
        })
        .catch(err => { console.log(err); throw new Error('fail'); })
};

Occasionally, this will hang on session.run for a long period of time (~60 seconds?). After that, we get a ETIMEDOUT error. Hit that function again and it works fine, so it randomly seems to do this.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 18 (11 by maintainers)

Most upvoted comments

@lutovich That was it!!! Ahh, so silly.

Not only does it completely fix the issue (I can’t get it to block at all anymore), but now the queries are super fast. They used to take about 500ms-1500ms, but now are instant. When I spam the query in GraphiQL, the spinner doesn’t even move because it’s too fast, hahaha! It’s faster than I can blink! 👍

Amazing. Fixes my app and makes it way way way faster.

Thank you so much for your help. So key thing to take from this all was: MAKE SURE TO USE ONE INSTANCE OF DRIVER FOR APP. My app is structured a lot like: https://github.com/apollostack/GitHunt-API/blob/master/api/index.js#L60 (my production app uses a lot more data sources than just Neo4j), so that’s where new awfully wrong for the case of this driver, hahaha.

Wooooo! 🎉 🎈 👍 It’s super fast! I used to think “Umm Bolt doesn’t seem to make that much of a difference…”, but now I see I was just doing it wrong. >.> It is clearly blazing fast.

GraphQL + Neo4j (with Bolt 😄 ) = winning combo

(You’re welcome to export that repo database if you still want to. It’s all fake data I was just playing with.)