Scripting: Reset Lua fake client reply_bytes after command execution.
Scripting: Reset Lua fake client reply_bytes after command execution.

Lua scripting uses a fake client in order to run commands in the context
of a client, accumulate the reply, and convert it into a Lua object
to return to the caller. This client is reused again and again, and is
referenced by the server.lua_client globally accessible pointer.

However after every call to redis.call() or redis.pcall(), that is
handled by the luaRedisGenericCommand() function, the reply_bytes field
of the client was not set back to zero. This filed is used to estimate
the amount of memory currently used in the reply. Because of the lack of
reset, script after script executed, this value used to get bigger and
bigger, and in the end on 32 bit systems it triggered the following
assert:

    redisAssert(c->reply_bytes < ULONG_MAX-(1024*64));

On 64 bit systems this does not happen because it takes too much time to
reach values near to 2^64 for users to see the practical effect of the
bug.

Now in the cleanup stage of luaRedisGenericCommand() we reset the
reply_bytes counter to zero, avoiding the issue. It is not practical to
add a test for this bug, but the fix was manually tested using a
debugger.

This commit fixes issue #656.

dayuoba/redis,soloestoy/redis,Wangyao14cyy/redis,zhcy/redis,AplayER/redis,izhoujie/redis,jbochi/redis,huangz1990/annotated_redis_source,honestme/redis,hornen/redis,csuhawk/redis,himoca/redis,ketor/redis,iandyh/redis,guker/redis,abhiklodh/redis,ton31337/redis,guker/redis,xuguruogu/redis,qiyang0221/redis,vincent-vivian-liu/redis,itamarhaber/redis,saisai/redis,tjschuck/redis,tanghaodong25/redis,duanx/redis,splitice/redis,yossigo/redis,pkdevbox/redis,guker/redis,ChanningDuan/annotated_redis_source,colstrom/redis,RepmujNetsik/redis,a-pavlov/redis,antirez/redis,xlzhan/redis,yossigo/redis,unasm/redis-3.0-annotated,seppo0010/redis,twskipper/redis,mingyaaaa/redis,AplayER/redis,j0hnma/szredis,alenslan/redis,sunheehnus/redis,tzq668766/redis-3.0-annotated,j0hnma/hszredis,tjschuck/redis,cloudrain21/redis,tzq668766/redis-3.0-annotated,wuyu201321060203/redis-3.0-annotated,ttuna/msot-redis,blackmady/redis,shining-yang/redis,StevenTsai/redis,soveran/redis,idning/redis,ErikDubbelboer/redis,shining-yang/redis,yossigo/redis,YongMan/redis,zhiliaoniu/redis,tjschuck/redis,StevenTsai/redis,flashbuckets/redis,machicao2013/redis-source-annotated,soloestoy/redis,hornen/redis,a-pavlov/redis,pkdevbox/redis,timothyohare/3rdPartySrc-redis,dongqifan2/redis-3.0-annotated,j0hnma/szredis,clamoriniere1A/redis,itugs/redis,supasate/redis,spearhead-ea/redis,fengshao0907/redis-3.0-annotated,figoxu/annotated_redis_source,ttuna/msot-redis,ituncle/redis,aim-for-better/redis,PKRoma/redis,huangz1990/experiment-redis,SyntaxStacks/redis,programmecat/redis,YuanZhewei/redis,SyntaxStacks/redis,0x55/redis-3.0-annotated,qiyang0221/redis,tellapart/redis,wenxueliu/redis_comment,cloudrain21/redis,YuanZhewei/redis,hgl888/redis,spearhead-ea/redis,jasonkying/redis,tanghaodong25/redis,jbochi/parallel_redis,roth1002/redis,fengshao0907/redis,190235047/redis,fankeke/redis-3.0-annotated,wprice/redis,figoxu/annotated_redis_source,nilyang/redis-tdd-annotation,nuxeh/redis,danny200309/annotated_redis_source,allengaller/redis,jingjidejuren/redis,LongXQ/redis,charsyam/redis,Cisphyx/redis-websockets,unasm/redis-3.0-annotated,josiahcarlson/redis,mumingv/redis,wujf/redis,tidatida/annotated_redis_source,tanghaodong25/redis,pcarrier/redis,taoguan/redis,colstrom/redis,dreamquster/redis,moonbingbing/redis-3.0-annotated,ErikDubbelboer/redis,AALEKH/redis,atreeyang/redis,pedigree/redis,huangz1990/experiment-redis,holstvoogd/redis,ton31337/redis,riyan8250/redis,dreamquster/redis,dramenk/annotated_redis_source,ouyangkongtong/redis,wangyikai/redis,shshlzh/redis-3.0-annotated,HunanTV/redis,rouzier/redis,brg-liuwei/redis,netroby/redis,cloudrain21/redis,gilala/hbjredis,himoca/redis,netroby/redis,slfs007/mk-redis,arijitvt/redis,aluzzardi/redis,clamoriniere1A/redis,jermnelson/redis,RepmujNetsik/redis,universsky/redis,itamarhaber/redis,0x55/redis-3.0-annotated,SyntaxStacks/redis,ytjiang/redis,timothyohare/3rdPartySrc-redis,dayuoba/redis,msn217/redis-3.0-annotated,pcarrier/redis,huyuezheng/redis,ouyangkongtong/redis,miaoyc1989/redis-3.0-annotated,jacklee0810/redis-3.0-annotated,0x20h/redis,seppo0010/redis,mpalmer/redis,gongice/redis-3.0-annotated,abhiklodh/redis,ofirluzon/redis,pietern/redis,Soledad89/redis,hawkchch/redis,splitice/redis,rogerchina/redis,NBSW/redis,GitHubMota/redis,gilala/hredis,190235047/redis,gechong/redis-3.0-annotated,takeshineshiro/redis,maodeyi/redis_lua,wujf/redis,jbochi/parallel_redis,atreeyang/redis,himoca/redis,GitHubMota/redis,buobao/redis-3.0-annotated,gilala/hbjredis,j0hnma/hszredis,blackmady/redis,spearhead-ea/redis,PKRoma/redis,janekmi/redis,jbochi/parallel_redis,wangyikai/redis,jacklee0810/redis-3.0-annotated,hedisdb/hedis,ytjiang/redis,neomantra/redis,sunheehnus/redis,elkingtonmcb/redis,soloestoy/redis,cnbin/redis,CodeJuan/redis,Cisphyx/redis-websockets,louisliangjun/redis,JoeWoo/redis,soveran/redis,brg-liuwei/redis,ipmobiletech/redis,gongice/redis-3.0-annotated,adamweixuan/redis-3.0-annotated,gaoxianglong/redis,rouzier/redis,izhoujie/redis,machicao2013/redis-source-annotated,cnbin/redis,idning/redis,netroby/redis,kaushik94/redis,supasate/redis,ouyangkongtong/redis,zhaobo1023/redis-3.0-annotated,idning/redis,jackyan/redis,jingjidejuren/redis,jacklee0810/redis-3.0-annotated,netroby/redis,pmem/redis,sunlianqiang/redis-3.0-annotated,huangz1990/annotated_redis_source,ofirluzon/redis,july2993/redis,programmecat/redis,PKRoma/redis,huyuezheng/redis,holstvoogd/redis,kaushik94/redis,wujf/redis,fengshao0907/annotated_redis_source,universsky/redis,arijitvt/redis,fengshao0907/redis,badboy/redis,Hailei/redis,yossigo/redis,AplayER/redis,aim-for-better/redis,zhcy/redis,tellapart/redis,nnog/redis,190235047/redis,0x20h/redis,gilala/hredis,Hailei/redis,huangz1990/redis-3.0-annotated,wuyu201321060203/redis-3.0-annotated,yuzhangjob/redis-3.0-annotated-unstable,jasonkying/redis,HeartSaVioR/redis,OmarQunsul/graph-redis,valdsJohn/redis,ReadCode/redis-3.0-annotated,gechong/redis-3.0-annotated,PKRoma/redis,dayuoba/redis,j0hnma/szredis,flashbuckets/redis,zhiliaoniu/redis,xuguruogu/redis,JoeWoo/redis,LongXQ/redis,vincent-vivian-liu/redis,elkingtonmcb/redis,csuhawk/redis,mingyaaaa/redis,seppo0010/redis,YuanZhewei/redis,HeartSaVioR/redis,Sciumo/redis,honestme/redis,aim-for-better/redis,rouzier/redis,rogerlz/redis,Sciumo/redis,darksideofthemoo/redis-histogram,YongMan/redis,rogerchina/redis,itugs/redis,simplestbest/redis,xuzhezhaozhao/redis_reading,ketor/redis,mgk/redis,LongXQ/redis,magastzheng/redis-3.0-annotated,iandyh/redis,supasate/redis,YongMan/redis,shshlzh/redis-3.0-annotated,Aliceljm1/redis-3.0-annotated,zczhuohuo/redis,danny200309/annotated_redis_source,colstrom/redis,simplestbest/redis,sunheehnus/redis,jingjidejuren/redis,colstrom/redis,tjschuck/redis,h0x91b/redis,huangz1990/annotated_redis_source,zhoudayang/redis,allengaller/redis,dramenk/annotated_redis_source,mengzhejin/RedisStudy,HeartSaVioR/redis,HouKangkang/redis-3.0-annotated,jxwr/redis,oranagra/redis,z-fork/redis,spinlock/redis,gspandy/annotated_redis_source,atreeyang/redis,hhli/redis,healerkx/redis,SyntaxStacks/redis,ksarch-saas/redis,zczhuohuo/redis,mingyaaaa/redis,jxwr/redis,PradheepShrinivasan/redis,takeshineshiro/redis,pmem/redis,AplayER/redis,whille/redis-3.0-annotated,jermnelson/redis,pcarrier/redis,hedisdb/hedis,0x20h/redis,programmecat/redis,OmarQunsul/graph-redis,qiyang0221/redis,saisai/redis,gilala/redis,neomantra/redis,taoguan/redis,splitice/redis,nuxeh/redis,neomantra/redis,gilala/bjredis,gilala/hbjredis,fengshao0907/redis,nnog/redis,janekmi/redis,drinkthere/redis-3.0-annotated,zy416548283/redis-3.0-annotated,YuraLukashik/redis,Aliceljm1/redis,mpalmer/redis,supasate/redis,buobao/redis-3.0-annotated,francischan714/redis,z-fork/redis,wprice/redis,4396/redis,xlzhan/redis,ofirluzon/redis,MOON-CLJ/redis,riyan8250/redis,ipmobiletech/redis,MasahikoSawada/redis,devaos/redis,GrimDerp/redis,gilala/redis,onlymellb/redis-3.0-annotated,taoguan/redis,NBSW/redis,Wangyao14cyy/redis,spinlock/redis,h0x91b/redis,saisai/redis,mverrilli/redis,tidatida/annotated_redis_source,yuhc/redis-benchmark-enhanced,davidradunz/redis,ctripcorp/redis,GrimDerp/redis,july2993/redis,mattsta/redis,mattsta/redis,harrisonfeng/redis,ctripcorp/redis,mverrilli/redis,wenxueliu/redis_comment,wbailey5/redis,HunanTV/redis,Wangyao14cyy/redis,mverrilli/redis,rouzier/redis,ramonsnir/redis,itugs/redis,PKRoma/redis,gongice/redis-3.0-annotated,YongMan/redis,mgk/redis,ofirluzon/redis,universsky/redis,blackmady/redis,fengshao0907/redis-3.0-annotated,YuraLukashik/redis,fengshao0907/annotated_redis_source,ipmobiletech/redis,healerkx/redis,takeshineshiro/redis,gaoxianglong/redis,rogerlz/redis,pmem/redis,hedisdb/hedis,zhiliaoniu/redis,miaoyc1989/redis-3.0-annotated,mpalmer/redis,brg-liuwei/redis,hawkchch/redis,h0x91b/redis,slfs007/mk-redis,Cisphyx/redis-websockets,Markgorden/redis,pietern/redis,maodeyi/redis_lua,izhoujie/redis,zczhuohuo/redis,zguangyu/redis,mengyou0304/redis,alenslan/redis,Aaron1992/redis,saisai/redis,mattsta/redis,seppo0010/rlite-server,Markgorden/redis,seandsky/redis,ituncle/redis,mumingv/redis,zhoudayang/redis,viongpanzi/annotated_redis_source,mcanthony/redis,kaushik94/redis,kmiku7/redis,moonbingbing/redis-3.0-annotated,seandsky/redis,ofirluzon/redis,mengzhejin/RedisStudy,hawkchch/redis,0x55/redis-3.0-annotated,mumingv/redis,jacklee0810/annotated_redis_source,flashbuckets/redis,badboy/redis,blackmady/redis,unasm/redis-3.0-annotated,mpalmer/redis,HunanTV/redis,gilala/hbjredis,JoeWoo/redis,zy416548283/redis-3.0-annotated,jbochi/redis,wprice/redis,seppo0010/redis,timothyohare/3rdPartySrc-redis,thomasdarimont/redis,ReadCode/redis-3.0-annotated,ttuna/msot-redis,davidradunz/redis,hgl888/redis,j0hnma/szredis,Aliceljm1/redis,valdsJohn/redis,xuzhezhaozhao/redis_reading,WorkingOfTimtohyZhang/redis-3.0-annotated,ytjiang/redis,rogerchina/redis,huangz1990/redis-3.0-annotated,josiahcarlson/redis,buobao/redis-3.0-annotated,mengzhejin/RedisStudy,hornen/redis,narma/redis,SummonY/redis,iandyh/redis,nuxeh/redis,ituncle/redis,wuxiaowei907/annotated_redis_source,weizijun/redis,huangz1990/redis-3.0-annotated,0x20h/redis,ksarch-saas/redis,roth1002/redis,Sciumo/redis,nnog/redis,Markgorden/redis,dreamquster/redis,gilala/hredis,sunlianqiang/redis-3.0-annotated,itamarhaber/redis,alenslan/redis,a-pavlov/redis,universsky/redis,mgk/redis,HeartSaVioR/redis,citusdata/redis,ytjiang/redis,gilala/redis,darksideofthemoo/redis-histogram,zguangyu/redis,ctripcorp/redis,ton31337/redis,gaoxianglong/redis,honestme/redis,whille/redis-3.0-annotated,RepmujNetsik/redis,machicao2013/redis-source-annotated,mverrilli/redis,kmiku7/redis,xuguruogu/redis,duanx/redis,YuraLukashik/redis,ChaosCoo/annotated_redis_source,francischan714/redis,tellapart/redis,nilyang/redis-tdd-annotation,mcanthony/redis,ChaosCoo/annotated_redis_source,moonbingbing/redis-3.0-annotated,jackyan/redis,narma/redis,zguangyu/redis,atreeyang/redis,charsyam/redis,ouyangkongtong/redis,yybirdcf/learn-redis,Hailei/redis,mcanthony/redis,ncopa/redis,idning/redis,modulexcite/redis,cusspvz/redis,taoguan/redis,harrisonfeng/redis,a-pavlov/redis,pkdevbox/redis,programmecat/redis,ReadCode/redis-3.0-annotated,linfangrong/redis,pietern/redis,valdsJohn/redis,yuhc/redis-benchmark-enhanced,RepmujNetsik/redis,louisliangjun/redis,fengshao0907/redis-3.0-annotated,huangz1990/experiment-redis,whille/redis-3.0-annotated,ctripcorp/redis,citusdata/redis,jbochi/redis,wuxiaowei907/annotated_redis_source,itamarhaber/redis,kensou97/redis,NBSW/redis,tidatida/annotated_redis_source,yuzhangjob/redis-3.0-annotated-unstable,danny200309/annotated_redis_source,AALEKH/redis,simplestbest/redis,SummonY/redis,kmiku7/redis,shining-yang/redis,yybirdcf/learn-redis,citusdata/redis,rrsean/redis-3.0-annotated,modulexcite/redis,flashbuckets/redis,miaoyc1989/redis-3.0-annotated,aluzzardi/redis,jackyan/redis,harrisonfeng/redis,pkdevbox/redis,dongqifan2/redis-3.0-annotated,4396/redis,hgl888/redis,CodeJuan/redis,StevenTsai/redis,wbailey5/redis,wuyu201321060203/redis-3.0-annotated,thomasdarimont/redis,wangyikai/redis,arijitvt/redis,seandsky/redis,ttuna/msot-redis,ncopa/redis,yuhc/redis-benchmark-enhanced,dongqifan2/redis-3.0-annotated,charsyam/redis,shreesundara/redis,devaos/redis,xujunhai1991/redis,wuyu201321060203/redis-3.0-annotated,francischan714/redis,kensou97/redis,narma/redis,linfangrong/redis,seandsky/redis,Soledad89/redis,j0hnma/hszredis,pmem/redis,seppo0010/rlite-server,ErikDubbelboer/redis,darksideofthemoo/redis-histogram,janekmi/redis,riyan8250/redis,jasonkying/redis,allengaller/redis,190235047/redis,Aaron1992/redis,clamoriniere1A/redis,ncopa/redis,sunheehnus/redis,yuzhangjob/redis-3.0-annotated-unstable,drinkthere/redis-3.0-annotated,badboy/redis,gilala/bjredis,shshlzh/redis-3.0-annotated,MasahikoSawada/redis,duanx/redis,0x55/redis-3.0-annotated,AALEKH/redis,MOON-CLJ/redis,hhli/redis,mcanthony/redis,hgl888/redis,pedigree/redis,MasahikoSawada/redis,shining-yang/redis,GitHubMota/redis,janekmi/redis,soloestoy/redis,machicao2013/redis-source-annotated,zczhuohuo/redis,nnog/redis,twskipper/redis,hhli/redis,HouKangkang/redis-3.0-annotated,takeshineshiro/redis,MSOpenTech/redis,holstvoogd/redis,aim-for-better/redis,HouKangkang/redis-3.0-annotated,jingjidejuren/redis,4396/redis,devaos/redis,alenslan/redis,NBSW/redis,hawkchch/redis,nilyang/redis-tdd-annotation,oranagra/redis,holstvoogd/redis,simplestbest/redis,jackyan/redis,twskipper/redis,GrimDerp/redis,fengshao0907/redis,rrsean/redis-3.0-annotated,honestme/redis,maodeyi/redis_lua,zhaobo1023/redis-3.0-annotated,Soledad89/redis,linfangrong/redis,MSOpenTech/redis,CodeJuan/redis,badboy/redis,HunanTV/redis,dayuoba/redis,nuxeh/redis,zhoudayang/redis,darksideofthemoo/redis-histogram,GitHubMota/redis,hornen/redis,mengyou0304/redis,seppo0010/rlite-server,mingyaaaa/redis,oranagra/redis,Aliceljm1/redis,onlymellb/redis-3.0-annotated,wbailey5/redis,StevenTsai/redis,huyuezheng/redis,mumingv/redis,GrimDerp/redis,h0x91b/redis,z-fork/redis,elkingtonmcb/redis,mengyou0304/redis,oranagra/redis,xlzhan/redis,ksarch-saas/redis,rogerlz/redis,wenxueliu/redis_comment,figoxu/annotated_redis_source,neomantra/redis,mumingv/redis-3.0-annotated,ksarch-saas/redis,yossigo/redis,MSOpenTech/redis,zhiliaoniu/redis,haima-zju/redis-3.0-annotated,onlymellb/redis-3.0-annotated,LongXQ/redis,MSOpenTech/redis,pcarrier/redis,ketor/redis,brg-liuwei/redis,zguangyu/redis,ChaosCoo/annotated_redis_source,soveran/redis,cnbin/redis,antirez/redis,PradheepShrinivasan/redis,jacklee0810/annotated_redis_source,soloestoy/redis,kmiku7/redis,weizijun/redis,yybirdcf/learn-redis,charsyam/redis,xujunhai1991/redis,cusspvz/redis,iandyh/redis,Hailei/redis,arijitvt/redis,modulexcite/redis,slfs007/mk-redis,roth1002/redis,drinkthere/redis-3.0-annotated,jasonkying/redis,zhoudayang/redis,gspandy/annotated_redis_source,abhiklodh/redis,haima-zju/redis-3.0-annotated,ErikDubbelboer/redis,huyuezheng/redis,ttuna/msot-redis,Markgorden/redis,vincent-vivian-liu/redis,rogerchina/redis,ton31337/redis,ChanningDuan/annotated_redis_source,cusspvz/redis,fankeke/redis-3.0-annotated,soveran/redis,wprice/redis,Aaron1992/redis,gspandy/annotated_redis_source,adamweixuan/redis-3.0-annotated,weizijun/redis,zhcy/redis,july2993/redis,aluzzardi/redis,MasahikoSawada/redis,devaos/redis,ramonsnir/redis,duanx/redis,shreesundara/redis,xujunhai1991/redis,pedigree/redis,Aliceljm1/redis,harrisonfeng/redis,viongpanzi/annotated_redis_source,wenxueliu/redis_comment,Cisphyx/redis-websockets,xuzhezhaozhao/redis_reading,Aliceljm1/redis-3.0-annotated,wangyikai/redis,thomasdarimont/redis,ipmobiletech/redis,kensou97/redis,izhoujie/redis,kensou97/redis,qiyang0221/redis,kaushik94/redis,JoeWoo/redis,valdsJohn/redis,tellapart/redis,gilala/hredis,dreamquster/redis,oranagra/redis,weizijun/redis,twskipper/redis,july2993/redis,josiahcarlson/redis,gilala/redis,charsyam/redis,xujunhai1991/redis,Aaron1992/redis,magastzheng/redis-3.0-annotated,cusspvz/redis,hhli/redis,nilyang/redis-tdd-annotation,ChanningDuan/annotated_redis_source,z-fork/redis,pietern/redis,linfangrong/redis,wujf/redis,miaoyc1989/redis-3.0-annotated,itugs/redis,antirez/redis,ituncle/redis,ncopa/redis,Aliceljm1/redis-3.0-annotated,SummonY/redis,jxwr/redis,gechong/redis-3.0-annotated,YuraLukashik/redis,OmarQunsul/graph-redis,wuxiaowei907/annotated_redis_source,abhiklodh/redis,j0hnma/hszredis,zy416548283/redis-3.0-annotated,zhaobo1023/redis-3.0-annotated,fankeke/redis-3.0-annotated,mumingv/redis-3.0-annotated,josiahcarlson/redis,SummonY/redis,thomasdarimont/redis,healerkx/redis,aluzzardi/redis,YuanZhewei/redis,jacklee0810/annotated_redis_source,ramonsnir/redis,rogerlz/redis,PradheepShrinivasan/redis,sunlianqiang/redis-3.0-annotated,Sciumo/redis,riyan8250/redis,zhcy/redis,guker/redis,csuhawk/redis,louisliangjun/redis,huangz1990/experiment-redis,WorkingOfTimtohyZhang/redis-3.0-annotated,pedigree/redis,gilala/bjredis,spinlock/redis,rrsean/redis-3.0-annotated,xuguruogu/redis,shreesundara/redis,francischan714/redis,PradheepShrinivasan/redis,dramenk/annotated_redis_source,msn217/redis-3.0-annotated,fengshao0907/annotated_redis_source,AALEKH/redis,neomantra/redis,adamweixuan/redis-3.0-annotated,MOON-CLJ/redis,mumingv/redis-3.0-annotated,hedisdb/hedis,citusdata/redis,mengzhejin/RedisStudy,yuhc/redis-benchmark-enhanced,splitice/redis,vincent-vivian-liu/redis,elkingtonmcb/redis,cloudrain21/redis,4396/redis,tanghaodong25/redis,roth1002/redis,tzq668766/redis-3.0-annotated,seppo0010/rlite-server,gaoxianglong/redis,haima-zju/redis-3.0-annotated,msn217/redis-3.0-annotated,antirez/redis,yybirdcf/learn-redis,jermnelson/redis,Soledad89/redis,Wangyao14cyy/redis,xlzhan/redis,davidradunz/redis,spinlock/redis,mengyou0304/redis,louisliangjun/redis,shreesundara/redis,cnbin/redis,WorkingOfTimtohyZhang/redis-3.0-annotated,allengaller/redis,magastzheng/redis-3.0-annotated,MSOpenTech/redis,mgk/redis,modulexcite/redis,xuzhezhaozhao/redis_reading,healerkx/redis,shshlzh/redis-3.0-annotated,clamoriniere1A/redis,davidradunz/redis,OmarQunsul/graph-redis,timothyohare/3rdPartySrc-redis,gilala/bjredis,viongpanzi/annotated_redis_source,wbailey5/redis,CodeJuan/redis,csuhawk/redis