mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 09:00:51 +00:00
Check event loop creation return value. Fix #3951.
Normally we never check for OOM conditions inside Redis since the allocator will always return a pointer or abort the program on OOM conditons. However we cannot have control on epool_create(), that may fail for kernel OOM (according to the manual page) even if all the parameters are correct, so the function aeCreateEventLoop() may indeed return NULL and this condition must be checked.
This commit is contained in:
parent
3773c06d28
commit
238cebdd5e
@ -1782,6 +1782,12 @@ void initServer(void) {
|
||||
createSharedObjects();
|
||||
adjustOpenFilesLimit();
|
||||
server.el = aeCreateEventLoop(server.maxclients+CONFIG_FDSET_INCR);
|
||||
if (server.el == NULL) {
|
||||
serverLog(LL_WARNING,
|
||||
"Failed creating the event loop. Error message: '%s'",
|
||||
strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
server.db = zmalloc(sizeof(redisDb)*server.dbnum);
|
||||
|
||||
/* Open the TCP listening socket for the user commands. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user