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.

Runaway Promises on session.writeTransaction()

See original GitHub issue

When using the Bluebird package as a the global Promise engine, I keep on getting Runaway Promise warning on session.writeTransaction(). I have recently upgraded from Neo4j v3.5 to v4.0, so I had to upgrade the Neo4j driver as well. This issue does not occur with session.run() nor with session.beginTransaction().

System Info

  • Neo4j version: Enterprise 4.0.0
  • Neo4j Mode: Single instance
  • Driver version: Javascript lanaguage driver 4.0.1
  • Operating system: Ubuntu 18.04 on local machine (laptop)
  • Bluebird.js version: 3.5.5

Steps to reproduce

  1. Start the dockerized Neo4j conrainer
  2. Setup a Node.js server
  3. Install Bluebird.js and use it as the global promise engine (instructions on their website)
  4. Install the Neo4j javascript driver v4.0.1
  5. Run a MERGE/SET query with the session.writeTransaction() function

Stacktrace

Warning: a promise was created in a handler at domain.js:131:23 but was not returned from it, see http://goo.gl/rRqMUw at Promise.then (<redacted>/node_modules/bluebird/js/release/promise.js:154:17)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
Kefa7ycommented, Jul 27, 2020

@martin-neotech We are actually returning results from our functions. Furthermore, this issue only appeared when upgrading to the neo4j js driver v4.0.1. It used to work just fine without errors for multiple older driver versions.

Here is a (slightly modified) code snippet that is pulled from our code:

function getUserCount() {
  const session = driver.session();
  const statement = `
    MATCH (user: User)
    RETURN COUNT(user)`;

  return session
    .readTransaction((tx) => tx.run(statement))
    .then((result) => {
      session.close();
      const count = result.records[0]._fields[0];
      return count;
    })
    .finally(() => session.close());
}

As you can see, we do not leave runaway promises with our code, not even in insert functions. I firmly believe that this is an issue in the driver itself that started with the v 4.x updates. Could you please investigate into the matter?

1reaction
timsavalcommented, Mar 18, 2020

@lutovich thank you either way!

Read more comments on GitHub >

github_iconTop Results From Across the Web

The session API - Neo4j JavaScript Driver Manual
Retry logic can be configured when creating a session. The methods executeRead and executeWrite have replaced readTransaction and writeTransaction , which are ...
Read more >
node.js - What is/how to write multiple tx.run as a single ...
I'm not familiar with manual hanlding of transactions via session.beginTransaction() , but the documentation on session.writeTransaction() ...
Read more >
Mastering Embedded Linux Programming - Second Edition
A sample debug session. Debugging early code. Debugging modules. Debugging kernel code with kdb. Looking at an Oops. Preserving the Oops. Further reading....
Read more >
Rob Landley's blog thing for 2009.
(I had a macro wrapper that was going int unused=asprintf(), but then it complained about an unused variable. THERE IS NOTHING I WANT...
Read more >
CONFERENCE PROCEEDINGS NATIONAL COMPUTER ...
The purpose of the National Computer Conference is to provide an atmosphere in which designers, suppliers, users, managers, educators, and representatives ...
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