Comments (7)
The C client assumes malloc failure is a terminal condition (not recoverable).
from aerospike-client-c.
Lathakris - this is an interesting recent ( last 10 years ) debate among the C programmers I know. Linux ( the most used standard C library ) appears to literally never return null - it'll take out the process instead. While everyone agrees that malloc should be able to return 0 and continue, it seems more and more that returning 0 either doesn't happen, or could be considered a fatal error.
What library and platform are you using, and in what situation do you think that processing should continue in the face of being out of memory?
from aerospike-client-c.
Thank you so much for the response. I was just wondering if it returns null we can gracefully exit as opposed to the process crash, like the trace below.
__memcpy_sse2_unaligned () at ../sysdeps/x86_64/multiarch/memcpy-sse2-unaligned.S:35
#1 0x00000000006a852f in memcpy (__len=21370660, __src=0x7f85f1b9c039, __dest=) at /usr/include/x86_64-linux-gnu/bits/string3.h:51
#2 as_command_parse_bins (rec=rec@entry=0x7f85f4047780, p=0x7f85f1b9c039 "\001", n_bins=, deserialize=)
at src/main/aerospike/as_command.c:1028
#3 0x00000000006a87a1 in as_command_parse_result (err=, sock=0x7f85f8ff6fe0, deadline_ms=, user_data=0x7f85f8ff7100)
at src/main/aerospike/as_command.c:1096
#4 0x00000000006a771a in as_command_execute (cluster=0x2881a60, err=err@entry=0x7f85f8ff73a0, cn=cn@entry=0x7f85f8ff7110, command=0x7f85f8ff7070 "\002\003",
command_len=command_len@entry=90, timeout_ms=1000, retry_on_timeout=false, max_retries=1,tui sleep_between_retries_ms=0,
parse_results_fn=0x6a8566 <as_command_parse_result>, parse_results_data=parse_results_data@entry=0x7f85f8ff7100) at src/main/aerospike/as_command.c:474
#5 0x00000000006a326f in aerospike_key_get (as=0xb07f00 , err=0x7f85f8ff73a0, policy=0xb07fe8 <as+232>, key=0x7f85f8ff72f0, rec=0x7f85f8ff7258)
at src/main/aerospike/aerospike_key.c:111
#6 0x0000000000439fcb in aeroKeyGet (as=0xb07f00 , err=0x7f85f8ff73a0, key=0x7f85f8ff72f0, rec=0x7f85f8ff7258) at libs/libaero/libaero.c:369
from aerospike-client-c.
We will start checking for null and recover gracefully in the critical sections of code. Your example case qualifies because the malloc size is determined by the protocol stream received from the server which definitely should be checked.
from aerospike-client-c.
Thanks once again!
from aerospike-client-c.
BTW we are using Linux ubuntu
from aerospike-client-c.
C client 4.1.4 has been released.
http://www.aerospike.com/download/client/c/4.1.4/
from aerospike-client-c.
Related Issues (20)
- warning: 'MSG_NOSIGNAL' macro redefined (on macOS) HOT 1
- Deleting bins by setting values to null or empty string HOT 1
- Undefined symbols in static library HOT 2
- cmake support HOT 4
- Is this project still under maintenance HOT 1
- Unable to found benchmarks in aerospike-client-c HOT 2
- Logstash Pipeline Error
- Crash in as_node_ensure_login_shm when remote servers are restarted HOT 16
- Compile failed with "the clang compiler does not support '-march=nocona'" HOT 2
- crash inside as_cluster_tend on arm64 HOT 4
- Give a name to worker threads HOT 3
- apple silicon / arm support HOT 9
- Release tagged 4.6.24 refers to missing .gitmodules HOT 1
- On batch reads only AS_POLICY_REPLICA_SEQUENCE will actually find new nodes for requests, AS_POLICY_REPLICA_ANY will try the same node and fail again. HOT 6
- aerospike-client-c link error with extra compiler flags -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer HOT 1
- can not build without lua HOT 1
- Missing as_buffer.h in installed includes HOT 1
- scan callback failing with memory fault issue HOT 1
- Build fails for 6.4.1 with luajit HOT 1
- crash on exit in as_cluster_tender (after libuv event loop is stopped) HOT 5
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-c.