Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API cause core dumps by referencing data that can be released by user #8

Closed
AlgoTrader opened this issue Jul 25, 2014 · 3 comments
Closed

Comments

@AlgoTrader
Copy link

The following code make core dump:

char *addr = *(String::Utf8Value(addrVal->ToString()));
int port = portVal->Int32Value();
as_config_add_host(&asConfig, addr, port);

The code is plain and simple. But we have a problem. char *addr is on stack and released on function exit. Why aerospike C client cannot make a deep copy of the hostname if it needs it for long time? The following code solve the problem, but is ugly:

char *addr = *(String::Utf8Value(addrVal->ToString()));
int port = portVal->Int32Value();
as_config_add_host(&asConfig, strdup(addr), port);
@wchu-citrusleaf
Copy link
Contributor

Currently we expect as_config setup to immediately precede an aerospike_connect() call. And within the aerospike_connect() call, a deep copy of the host address is made.

Can you describe a situation where the configuration setup is not in the same scope as the connect call? And we will consider making the deep copy earlier.

Thanks.

@AlgoTrader
Copy link
Author

The situation is

char *addr = *(String::Utf8Value(addrVal->ToString()));
int port = portVal->Int32Value();
as_config_add_host(&asConfig, addr, port);

deep copy should be immediate, not delayed. But I also experienced many other core dumps, so I will not use AS in any serious projects.

@wchu-citrusleaf
Copy link
Contributor

we've considered this, and currently have opted for easier api of not requiring a config_destroy().

Regarding additional crashes, we have made extensive fixes, including the up coming release. Please do let us know if there are additional issues you hit, and we will do our best to address them. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants