79 Commits

Author SHA1 Message Date
antirez
081a0c943f Fix Sentinel memory leak (hiredis bug)
This fixes issue #2535, that was actually an hiredis library bug (I
submitted an issue and fix to the redis/hiredis repo as well).

When an asynchronous hiredis connection subscribes to a Pub/Sub channel
and gets an error, and in other related conditions, the function
redisProcessCallbacks() enters a code path where the link is
disconnected, however the function returns before freeing the allocated
reply object. This causes a memory leak. The memory leak was trivial to
trigger in Redis Sentinel, which uses hiredis, every time we tried to
subscribe to an instance that required a password, in case the Sentinel
was configured either with the wrong password or without password at
all. In this case, the -AUTH error caused the leaking code path to be
executed.

It was verified with Valgrind that after this change the leak no longer
happens in Sentinel with a misconfigured authentication password.
2015-04-28 22:15:12 +02:00
antirez
e47e460f1f Lua cmsgpack lib updated to latest version.
It fixes a bad bug that crashes the server in certain conditions
as shown in issue #2210.
2014-12-12 22:57:09 +01:00
antirez
0c211a1953 Simplify lua_cmsgpack macro and fix build on old Linux distros.
Thanks to @badboy for the help in checking the build after the fix.
2014-12-05 10:52:56 +01:00
Matt Stancliff
e305df099a Fix lua-cmsgpack 64 bit integer on 32 bit platform
This syncs lua-cmsgpack with the mattsta/lua-cmsgpack upstream.

Fixes #2161
2014-11-25 15:56:57 +01:00
antirez
ce96069676 lua_cjson.c Lua includes: angled -> quoted. 2014-11-14 17:28:54 +01:00
Matt Stancliff
381863be5c Lua: upgrade cmsgpack to 0.4.0
Main reasons for upgrade:
  - Remove a warning when building Redis
  - Add multi pack/unpack
  - Improve memory usage and use Lua allocator properly
  - Fix some edge case encoding/decoding bugs
2014-11-14 17:28:40 +01:00
Matt Stancliff
a7b58f1569 Lua: remove new warning added by cjson header
clang doesn't like "extern inline" when no definition
is given right away.
2014-11-14 17:28:35 +01:00
Matt Stancliff
56e1861398 Lua: Use Redis solaris compatability for cjson too
cjson calls isinf, but some Solaris versions don't have isinf
even with the attempted fix we have in deps/Makefile.

We can harmlessly include the Redis solarisfixes.h header to
give cjson proper isinf.

Note: cjson has a compile-time setting for using their own defined
isinf, but the Redis definition in solarisfixes.h is more complete.

Fixes antirez#1620
2014-11-14 17:28:32 +01:00
Matt Stancliff
e2983dd03f Lua: Upgrade cjson to 2.1.0 (2012-03-01)
The new cjson has some improvements over our current version including
increased platform compatability, a new resource limit to restrict
decode depth, and better invalid number handling.

One minor change was required to deps/Makefile because this version
of cjson doesn't export itself globally, so we added a quick little
define of -DENABLE_CJSON_GLOBAL.

cjson now has an optional higher performing float parsing interface,
but we are not including it (g_fmt.c, dtoa.c) because it requires
endianness declaration during compile time.

This commit is exactly lua_cjson.c from 2.1.0 with one minor
change of altering the two Lua includes for local search
instead of system-wide importing.
2014-11-14 17:28:27 +01:00
Matt Stancliff
1e501d9fd6 Lua: Add bitop
A few people have written custom C commands because bit
manipulation isn't exposed through Lua.  Let's give
them Mike Pall's bitop.

This adds bitop 1.0.2 (2012-05-08) from http://bitop.luajit.org/

bitop is imported as "bit" into the global namespace.

New Lua commands: bit.tobit, bit.tohex, bit.bnot, bit.band, bit.bor, bit.bxor,
bit.lshift, bit.rshift, bit.arshift, bit.rol, bit.ror, bit.bswap

Verification of working (the asserts would abort on error, so (nil) is correct):
127.0.0.1:6379> eval "assert(bit.tobit(1) == 1); assert(bit.band(1) == 1); assert(bit.bxor(1,2) == 3); assert(bit.bor(1,2,4,8,16,32,64,128) == 255)" 0
(nil)
127.0.0.1:6379> eval 'assert(0x7fffffff == 2147483647, "broken hex literals"); assert(0xffffffff == -1 or 0xffffffff == 2^32-1, "broken hex literals"); assert(tostring(-1) == "-1", "broken tostring()"); assert(tostring(0xffffffff) == "-1" or tostring(0xffffffff) == "4294967295", "broken tostring()")' 0
(nil)

Tests also integrated into the scripting tests and can be run with:
./runtest --single unit/scripting

Tests are excerpted from `bittest.lua` included in the bitop distribution.
2014-11-14 17:28:19 +01:00
antirez
b6203138d3 Linenoise README updated to match source code. 2014-10-06 10:02:08 +02:00
Aaron Rutkovsky
3101760937 Fix typos
Closes #1513
2014-10-06 09:59:02 +02:00
Matt Stancliff
d05fcaffa0 Update linenoise accessory files
The core linenoise code was being backported, but not
the README or example.  It's less confusing for users
if everything matches across directories.

Fix inspired by @thrig

Closes #1872
2014-10-06 09:57:01 +02:00
antirez
04b6945ebc Linenoise lib updated. 2014-09-22 14:56:01 +02:00
Matt Stancliff
cf143b571e Fix hiredis getaddrinfo leak
Fixed in Redis by 1a5e5b6, but since that part of code
is largely copy/paste from Redis, the fix needs to be
ported over too.

Closes #2012
2014-09-19 14:21:36 +02:00
antirez
97fdcd8746 Missing va_end also added in hiredis copy of sds.c. 2014-08-27 10:31:41 +02:00
Mariano Pérez Rodríguez
45fac9481a Missing assert removal from sdsIncrLen()
Companion for 8eeb1802ec42682a614a5ebca318a0ba44ca7c03, but dealing with hiredis.
2014-08-27 10:31:35 +02:00
antirez
134345e332 Use unsigned integers in SDS header.
This raises the max string to 4GB without any downside.
2014-08-27 10:25:54 +02:00
Daniel Price
1aff711d90 Define AR to help with lua cross-compilation
Closes #997
2014-08-27 10:25:34 +02:00
siahl
b5dc2c5b91 Add support for compiling on AIX
Closes #1900
2014-08-27 10:22:28 +02:00
antirez
95f492ee57 Silence different signs comparison warning in sds.c. 2014-06-23 11:53:50 +02:00
antirez
364464e790 Use Redis updated sds.c for deps/hiredis. 2014-06-23 11:53:45 +02:00
antirez
a8ecd3f040 Dummy zmalloc.h restored into deps/hiredis. 2014-06-23 11:53:15 +02:00
Matt Stancliff
6ee25dc439 hiredis: Update to latest version
This is hiredis f225c276be7fd0646019b51023e3f41566633dfe

This update includes all changes that diverged inside of Redis since
the last update.  This version also allows optional source address
binding for connections which we need for some Sentinel deployments.
2014-06-23 11:53:12 +02:00
antirez
ebc62a6f35 Jemalloc updated to 3.6.0.
Not a single bug in about 3 months, and our previous version was
too old (3.2.0).
2014-06-20 15:01:36 +02:00
antirez
a0e0fba7fa Jemalloc update script added. 2014-06-20 14:53:47 +02:00
antirez
3703112671 Linenoise updated, multiline mode enabled in redis-cli. 2014-03-13 15:12:04 +01:00
yihuang
706056ca16 fix lua_cmsgpack pack map as array 2013-08-13 17:48:40 +08:00
antirez
0e72cc601f Fix sdsempty() prototype in sds.h. 2013-08-12 11:38:28 +02:00
antirez
aea8020554 Use latest sds.c in the hiredis library under deps. 2013-07-25 10:34:02 +02:00
antirez
4cfd70e903 hiredis: minimal IPv6 support. 2013-07-11 17:09:35 +02:00
antirez
2b427a89fb Lua updated to version 5.1.5. 2013-04-29 12:02:01 +02:00
antirez
0e3baa5241 Redis/Jemalloc Gitignore were too aggressive.
Redis gitignore was too aggressive since simply broken.

Jemalloc gitignore was too agressive because it is conceived to just
keep the files that allow to generate all the rest in development
environments (so for instance the "configure" file is excluded).
2013-04-18 16:23:12 +02:00
Johan Bergström
ca0b1c2436 Inherit CC for Lua 2013-04-02 11:26:50 +02:00
Johan Bergström
49eef7738e Spaces to tabs 2013-04-02 11:26:41 +02:00
antirez
153766e137 Lua struct library updated to version 0.2.
There was a bug in the previous version of this library that caused a
crash under the circumstances described in issue #901.

The newer version of the library appears to be fixed (I tested it
manually with valgrind and everything seems fine now).

For more information about this library please visit this web site:

    http://www.inf.puc-rio.br/~roberto/struct/
2013-01-23 10:53:31 +01:00
antirez
6fa2610ac9 Added missing license and copyright in deps/hiredis. 2012-12-17 11:11:36 +01:00
Patrick TJ McPhee
5207c03c49 Define _XOPEN_SOURCE appropriately on NetBSD. 2012-12-12 18:42:41 +01:00
antirez
053f1f357d Jemalloc updated to version 3.2.0. 2012-11-28 18:42:35 +01:00
antirez
655e6838fb 32 bit build fixed on Linux.
It failed because of the way jemalloc was compiled (without passing the
right flags to make, but just to configure). Now the same set of flags
are also passed to the make command, fixing the issue.

This fixes issue #744
2012-11-01 15:40:46 +01:00
antirez
6c7e957d17 Ctrl+w support in linenoise. 2012-10-30 19:11:46 +01:00
antirez
7fcba9fd9a hiredis library updated.
This version of hiredis merges modifications of the Redis fork with
latest changes in the hiredis repository.

The same version was pushed on the hiredis repository and will probably
merged into the master branch in short time.
2012-08-22 11:33:57 +02:00
antirez
afc6bd1b48 Deleted jemalloc.orig from /deps.
In the commit upgrading jemalloc to version 3.0.0 I added the old
version of Jemalloc in the 'jemalloc.orig' directory for an error.
This commit removes the not useful version of jemalloc.
2012-05-16 12:22:29 +02:00
antirez
4934f93dfb Jemalloc updated to 3.0.0.
Full changelog here:

http://www.canonware.com/cgi-bin/gitweb.cgi?p=jemalloc.git;a=blob_plain;f=ChangeLog;hb=master

Notable improvements from the point of view of Redis:

1) Bugfixing.
2) Support for Valgrind.
3) Support for OSX Lion, FreeBSD.
2012-05-16 11:20:44 +02:00
Pieter Noordhuis
de07849e0d Clean up Makefiles
Remove unused variables. Instead of overriding non-standard variables
such as ARCH and PROF, use standard variables CFLAGS and LDFLAGS to
override Makefile settings. Move dependencies generated by `make dep` to
a separate file.
2012-04-11 12:01:29 +02:00
antirez
36e6637dfd lua_cmsgpack.c added 2012-02-24 15:46:25 +01:00
antirez
63505e0b59 Lua_cmsgpack added to Redis scripting. 2012-02-24 15:45:16 +01:00
antirez
ad0df18fdc Fix 32bit build of hiredis 2012-02-19 20:49:20 +01:00
antirez
8e65b6a33d Applied a few modifications to hiredis to tune it for speed (redis-benchmark) and ability to read more deeply nested replies (redis-cli). 2012-02-19 20:33:59 +01:00
antirez
b66e5add82 The hiredis lib shipped with Redis was updated to latest version. 2012-02-19 20:26:50 +01:00