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.

Synchronous error callback in query command causes "unspecified" error in record stream

See original GitHub issue

In our test code we are using AS.query and on error it gives a complete halt of system.

events.js:146
      throw err;
      ^

Error: Uncaught, unspecified "error" event. ([object Object])
    at RecordStream.emit (events.js:144:17)
    at /home/ec2-user/testcode/node_modules/aerospike/lib/query.js:315:14
    at Query.foreach (/home/ec2-user/testcode/node_modules/aerospike/lib/query.js:313:11)
    at async.parallel.datasearch (/home/ec2-user/testcode/webnew.js:2301:27)
    at /home/ec2-user/testcode/node_modules/async/dist/async.js:3671:13
    at replenish (/home/ec2-user/testcode/node_modules/async/dist/async.js:884:21)
    at iterateeCallback (/home/ec2-user/testcode/node_modules/async/dist/async.js:869:21)
    at /home/ec2-user/testcode/node_modules/async/dist/async.js:847:20
    at /home/ec2-user/testcode/node_modules/async/dist/async.js:3676:17
    at /home/ec2-user/testcode/node_modules/async/dist/async.js:339:31

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:20 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
jheckingcommented, Oct 14, 2016

There are two main differences between batchRead and batchGet:

  1. batchRead uses the newer Batch Index protocol, while batchGet uses the legacy Batch Direct protocol. You can read about the differences between the two protocols here: http://www.aerospike.com/docs/guide/batch.html.
  2. batchRead uses asynchronous I/O when communicating with the Aerospike server; batchGet uses synchronous, blocking I/O. In order to provide an async., callback-based API in the JS layer, the batchGet command uses libuv worker threads when communicating with the server. By default, Node.js only uses a worker pool of 4 threads so this can become a bottle neck. I went into a bit more details about the difference between synchronous and asynchronous I/O in a recent blog post, which you can find here: http://www.aerospike.com/blog/win-win-greater-speed-and-lower-latency-with-aerospikes-node-js-client-v2-0/.

I would recommend that you upgrade to the v2 as it might address they issues that you are seeing.

0reactions
GavinDmellocommented, Apr 20, 2017

Great 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Database Engine events and errors - SQL Server
Consult this MSSQL error code list to find explanations for error messages for SQL Server database engine events.
Read more >
Better Error Handling In NodeJS With Error Classes
This article is for JavaScript and NodeJS developers who want to improve error-handling in their applications.
Read more >
node-mssql | Microsoft SQL Server client for Node.js
command - T-SQL command to be executed. callback(err, recordset) - A callback which is called after execution has completed, or an error has...
Read more >
Node.js Error Handling Best Practices - Sematext
Learn what is Node.js error handling and why do you need it. From using middleware to catching uncaught exceptions, discover the best ways ......
Read more >
Error and Transaction Handling in SQL Server Part Two
Having XACT_ABORT ON by Default? Additional Syntax for BEGIN/COMMIT/ROLLBACK TRANSACTION. SAVE TRANSACTION. SET IMPLICIT_TRANSACTIONS ON. Some More Obscure SET ...
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