检测到luaRedisGenericCommand()递归调用

时间:2016-11-01 12:38:34

标签: recursion lua redis

我使用Microsoft.Web.RedisSessionStateProvider作为sessionState Provider,它运行许多lua脚本。但是我的应用程序遇到了这个例外:

  

@user_script:14:luaRedisGenericCommand()检测到递归调用。   你在使用Lua调试钩子做有趣的事吗?

redis source code开发人员说:

static int inuse = 0;   /* Recursive calls detection. */

/* By using Lua debug hooks it is possible to trigger a recursive call
 * to luaRedisGenericCommand(), which normally should never happen.
 * To make this function reentrant is futile and makes it slower, but
 * we should at least detect such a misuse, and abort. */
if (inuse) {
    char *recursion_warning =
        "luaRedisGenericCommand() recursive call detected. "
        "Are you doing funny stuff with Lua debug hooks?";
    redisLog(REDIS_WARNING,"%s",recursion_warning);
    luaPushError(lua,recursion_warning);
    return 1;
}
inuse++;

但我不知道如何检测这种递归以及如何避免这种错误!

1 个答案:

答案 0 :(得分:0)

回收应用程序池并清除Redis缓存,它将正常运行..