Comments (14)
Totally agreed the way it handles error is very bad.In some cases it crashes the entire application. With error message segmentation fault (core dump )
from aerospike-client-nodejs.
After dozens of core dumps with their C client and very poor support of scripting langs I am not considering AS as a serious production-ready solution. I am also not happy of how they communicate to developers, so, I put it off.
from aerospike-client-nodejs.
I agree it is idiomatic to not return the error on a success. We plan on changing it, but we have to weigh the impact on existing users, which I should have mentioned earlier, but I had let it slip. Apologies.
@vivekkrbajpai It is my first time hearing about core dumps associated with error objects. Can you file another ticket so we can follow up on that issue?
As for other issues, we work diligently to resolve them. We hope you are patient enough to wait for a resolution or assist us by indicating the severity of the issue with regards to your product, so we can prioritize accordingly.
from aerospike-client-nodejs.
Thanks for the response @cstivers78 👍 .I will create the new issue with my logs.
from aerospike-client-nodejs.
👍 from my side for passing null
as a first callback argument if the operation was successful, this was confusing me right away when I started to work with the node driver.
But if you do the change, please stick to the node conventions and pass in null
as a first argument if the operation was successful (as opposed to undefined
which is mentioned in the title of this issue). It is common convention to pass null
, not undefined
, see e.g. http://fredkschott.com/post/2014/03/understanding-error-first-callbacks-in-node-js/
from aerospike-client-nodejs.
undefined and null for error are both valid. The difference is subtle.
callback() is success with undefined
callback(null) is also success but with null
They live in their own world, I do not think they care of node.js style and conventions. They just mechanically ported C client to node
from aerospike-client-nodejs.
@AlgoTrader a matter of taste I suppose. I think it is good node.js style to explicitly state the success case calling callback(null);
;)... But as I said, it's probably a matter of taste. Anything falsy should usually do since the canonical way of error handling is usually:
asyncStuff(function(err, result) {
if (err) {
console.error(err);
return;
}
// do stuff with result
});
from aerospike-client-nodejs.
You are right, matter of taste. I use null but for third party code I also expect undefined
from aerospike-client-nodejs.
Just chiming in that this is very much an antipattern within node and that for things that assume falsy
values (like libraries that convert callbacks to thunks/promises) it breaks them. +1 for changing it. No opinion on null
vs undefined
(null
does feel more "node") but it should definitely not be an object on success.
from aerospike-client-nodejs.
+1 Aerospike is phenomenal, but this issue makes the Node driver very unpleasant to work with. It breaks the convention, and it makes it hard to wrap with bluebird. Maybe you could include a flag when initializing the client, if not changing it altogether?
var client = aerospike.client({
hosts: [ { addr: '127.0.0.1', port: 3000 } ],
standardNodeError: true // error === undefined upon success
});
from aerospike-client-nodejs.
This currently really stands in my way to really dive into aerospike 100% will a PR be quickly welcomed? @cstivers78
There is a similar issue with (the user incorrectly) passing, taht floats breaking the client or similar.
from aerospike-client-nodejs.
@eljefedelrodeodeljefe, a pull request would be welcome! As Chris had pointed out, this is a backwards incompatible change and can potentially affect existing application code. So we need to be mindful of this. Maybe you can open a PR and quickly describe the changes you plan to do? I'd be happy to work with you on this.
from aerospike-client-nodejs.
from aerospike-client-nodejs.
For v2 of the Aerospike Node.js client we have changed the semantics of the callbacks done by the client to follow the Node.js error-first callback semantics where the error argument is null
if the operation was successful. v2 is now available as a pre-release in version 2.0.0-alpha.1
on npmjs.com.
Some additional resources:
from aerospike-client-nodejs.
Related Issues (20)
- Does aerospike-client-nodejs need python on runtime as well? HOT 1
- I cant install on windows 10 HOT 2
- Issue with using client.operate with policy exists: AS.policy.exists.CREATE HOT 1
- Serialized and blocking connection
- Unable to install aerospike with nexus3 HOT 16
- Unable to install v5.9.0 with yarn, published version requires "npm-run-all" HOT 3
- System's openssl version since static linking in v5.6.0 HOT 4
- Missing 'bool/AS_EXP_TYPE_BOOL' in exp bin type HOT 2
- Unable to use pnpm package manager because of preinstall script of the package HOT 2
- Client.close(true) does not release underlying event loop HOT 2
- Segmentation fault with secondary index query HOT 12
- Typescript build fails HOT 1
- Segmentation fault crash core dump with 5.11.0 HOT 3
- Can't install with node 22 HOT 2
- --build-from-source is broken on Rocky 9, node 20
- Unable to get a record by filter 'contains' if bin array includes > 1 element
- Unable to find record by regexp pattern
- Aerospike.maps.returnType.KEY_VALUE is missing
- client.exist(key) is missing metadata
- signature of 'batchRead' is incorrect in typings HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aerospike-client-nodejs.