简体   繁体   English

Redis偶尔挂起

[英]Redis occasional hangs

We have a single standalone Redis (2.8.2104) for Windows node running on a server. 我们在服务器上运行的Windows节点有一个独立的Redis(2.8.2104)。

Two other server are communicating with this instance. 另外两个服务器正在与此实例通信。

We use it with SignalR and for caching. 我们将其与SignalR一起使用并进行缓存。 The dump has a size of about 700MB 转储的大小约为700MB

From time to time we have hangs for 1-3 minutes. 有时我们会挂1-3分钟。 After this it recovers by itself. 此后,它会自行恢复。

The error seems to only occur when there is some traffic on our page. 该错误似乎仅在我们的页面上有流量时才会发生。

In this time we get the exception you can see below 这一次我们得到了异常,您可以在下面看到

StackExchange.Redis.RedisConnectionException: SocketFailure on EVAL at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Owin.Cors.CorsMiddleware.d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Owin.Mapping.MapMiddleware.d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at StackExchange.Redis.RedisConnectionException:System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)在EVAL上的SocketFailure在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)在Microsoft.Owin.Cors.CorsMNextved。 )---从上一个引发异常的位置开始的堆栈跟踪---在Microsoft.Owin的System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task任务)处的System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务) .Mapping.MapMiddleware.d__0.MoveNext()---从上一个引发异常的位置开始的堆栈跟踪---位于System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)

When I search through the Redis log i can ocasssionally find these errors: 当我搜索Redis日志时,偶尔会发现以下错误:

[33144] 18 Feb 18:18:44.843 # [33144] 18 Feb 18:18:44.843#

=== REDIS BUG REPORT START: Cut & paste starting from here === [33144] 18 Feb 18:18:44.844 # Out Of Memory allocating 308457 bytes. === REDIS BUG报告开始:从此处剪切并粘贴=== [33144] 18 Feb 18:18:44.844#内存不足,分配308457字节。 [33144] 18 Feb 18:18:44.844 # --- ABORT [33144] 18 Feb 18:18:44.844 # --- STACK TRACE redis-server.exe!LogStackTrace(c:\\release\\redis\\src\\win32_interop\\win32_stacktrace.cpp:95)(0x00000016, 0x042E0028, 0x00000000, 0x00000001) redis-server.exe!AbortHandler(c:\\release\\redis\\src\\win32_interop\\win32_stacktrace.cpp:206)(0x00000001, 0x89EE7767, 0x40150880, 0xBB7A5ED7) redis-server.exe!raise(f:\\dd\\vctools\\crt\\crtw32\\misc\\winsig.c:587)(0x00000001, 0x00000000, 0x0004B4E9, 0x042E0028) redis-server.exe!abort(f:\\dd\\vctools\\crt\\crtw32\\misc\\abort.c:82)(0x00000001, 0x4013F888, 0x0004B4E9, 0x00008000) redis-server.exe!redisOutOfMemoryHandler(c:\\release\\redis\\src\\redis.c:3397)(0x0004B4E9, 0x4007DA07, 0x042E0028, 0x4007A27B) redis-server.exe!zmalloc(c:\\release\\redis\\src\\zmalloc.c:147)(0xBDF01150, 0x4007EB2C, 0xBDF01150, 0x446D6B10) redis-server.exe!sdsnewlen(c:\\release\\redis\\src\\sds.c:59)(0xBDF01150, 0xBDF01150, 0x3E74FD95, 0x00000003) redis-server.exe!_addReplyStringToList(c:\\release\\redis\\src\\networkin [33144] 18 Feb 18:18:44.844#---中止[33144] 18 Feb 18:18:44.844#---堆栈跟踪redis-server.exe!LogStackTrace(c:\\ release \\ redis \\ src \\ win32_interop \\ win32_stacktrace.cpp:95)(0x00000016,0x042E0028,0x00000000,0x00000001)redis-server.exe!AbortHandler(c:\\ release \\ redis \\ src \\ win32_interop \\ win32_stacktrace.cpp:206)(0x00000001,0x89EE7767,0x40150880ED,0xBB7is -server.exe!raise(f:\\ dd \\ vctools \\ crt \\ crtw32 \\ misc \\ winsig.c:587)(0x00000001,0x00000000,0x0004B4E9,0x042E0028)redis-server.exe!abort(f:\\ dd \\ vctools \\ crt \\ crtw32 \\ misc \\ abort.c:82)(0x00000001,0x4013F888,0x0004B4E9,0x00008000)redis-server.exe!redisOutOfMemoryHandler(c:\\ release \\ redis \\ src \\ redis.c:3397)(0x0004B4E9,0x4007DA28,0x042 ,0x4007A27B)redis-server.exe!zmalloc(c:\\ release \\ redis \\ src \\ zmalloc.c:147)(0xBDF01150、0x4007EB2C,0xBDF01150、0x446D6B10)redis-server.exe!sdsnewlen(c:\\ release \\ redis \\ src \\ sds.c:59)(0xBDF01150、0xBDF01150、0x3E74FD95、0x00000003)redis-server.exe!_addReplyStringToList(c:\\ release \\ redis \\ src \\ networkin g.c:271)(0xBDF01150, 0xBDF01150, 0x042E0028, 0x400E34FE) redis-server.exe!addReplyBulkCBuffer(c:\\release\\redis\\src\\networking.c:517)(0xFFFFFFFF, 0x042E0028, 0x01B77260, 0x01B77260) redis-server.exe!luaReplyToRedisReply(c:\\release\\redis\\src\\scripting.c:792)(0x00000004, 0xBDF01150, 0x00000002, 0x00000002) redis-server.exe!luaReplyToRedisReply(c:\\release\\redis\\src\\scripting.c:839)(0xFFFFFFFF, 0x00A7F690, 0x67897B20, 0xBDF01150) redis-server.exe!evalGenericCommand(c:\\release\\redis\\src\\scripting.c:1048)(0x71E66870, 0x00000000, 0x00000001, 0x000000B2) redis-server.exe!call(c:\\release\\redis\\src\\redis.c:2016)(0x56C60B04, 0x4008B000, 0x00000000, 0x000000B2) redis-server.exe!processCommand(c:\\release\\redis\\src\\redis.c:2235)(0xBDF01150, 0x000000B2, 0x000023B5, 0x00000001) redis-server.exe!processInputBuffer(c:\\release\\redis\\src\\networking.c:1274)(0xBDF01150, 0x00000000, 0x00000000, 0x00000001) redis-server.exe!readQueryFromClient(c:\\release\\redis\\src\\networking.c:1329)(0xFFE51650, 0x00000001, 0x4 gc:271)(0xBDF01150、0xBDF01150、0x042E0028、0x400E34FE)redis-server.exe!addReplyBulkCBuffer(c:\\ release \\ redis \\ src \\ networking.c:517​​)(0xFFFFFFFF,0x042E0028、0x01B77260、0x01B77260.exe) luaReplyToRedisReply(c:\\ release \\ redis \\ src \\ scripting.c:792)(0x00000004、0xBDF01150、0x00000002、0x00000002)redis-server.exe!luaReplyToRedisReply(c:\\ release \\ redis \\ src \\ scripting.c:839) (0xFFFFFFFF,0x00A7F690、0x67897B20、0xBDF01150)redis-server.exe!evalGenericCommand(c:\\ release \\ redis \\ src \\ scripting.c:1048)(0x71E66870、0x00000000、0x00000001、0x000000B2)redis-server.exe!调用(c :\\ release \\ redis \\ src \\ redis.c:2016)(0x56C60B04、0x4008B000、0x00000000、0x000000B2)redis-server.exe!processCommand(c:\\ release \\ redis \\ src \\ redis.c:2235)(0xBDF01150,0x000000B2 ,0x000023B5,0x00000001)redis-server.exe!processInputBuffer(c:\\ release \\ redis \\ src \\ networking.c:1274)(0xBDF01150,0x00000000,0x00000000,0x00000001)redis-server.exe!readQueryFromClient(c:\\ release \\ redis \\ src \\ networking.c:1329)(0xFFE51650、0x00000001、0x4 4726F20, 0x0000012C) redis-server.exe!aeMain(c:\\release\\redis\\src\\ae.c:487)(0x56C5C7F8, 0x00000002, 0x00000000, 0x00000002) redis-server.exe!redis_main(c:\\release\\redis\\src\\redis.c:3524)(0x0024BA50, 0x00000002, 0x56C5C7EB, 0x00000002) redis-server.exe!main(c:\\release\\redis\\src\\win32_interop\\win32_qfork.cpp:1363)(0x00000016, 0xFFFFFFFF, 0x00000016, 0x0023F3A0) redis-server.exe!ServiceWorkerThread(c:\\release\\redis\\src\\win32_interop\\win32_service.cpp:485)(0x4000B3D0, 0x00000000, 0x00000000, 0x00000000) KERNEL32.DLL!BaseThreadInitThunk(c:\\release\\redis\\src\\win32_interop\\win32_service.cpp:485)(0xBB0113B0, 0x00000000, 0x00000000, 0x00000000) ntdll.dll!RtlUserThreadStart(c:\\release\\redis\\src\\win32_interop\\win32_service.cpp:485)(0x00000000, 0x00000000, 0x00000000, 0x00000000) ntdll.dll!RtlUserThreadStart(c:\\release\\redis\\src\\win32_interop\\win32_service.cpp:485)(0x00000000, 0x00000000, 0x00000000, 0x00000000) [33144] 18 Feb 18:18:44.857 # === REDIS BUG REPORT END. 4726F20,0x0000012C)redis-server.exe!aeMain(c:\\ release \\ redis \\ src \\ ae.c:487)(0x56C5C7F8,0x00000002,0x00000000,0x00000002)redis-server.exe!redis_main(c:\\ release \\ redis \\ src \\ redis.c:3524)(0x0024BA50,0x00000002,0x56C5C7EB,0x00000002)redis-server.exe!main(c:\\ release \\ redis \\ src \\ win32_interop \\ win32_qfork.cpp:1363)(0x00000016,0xFFFFFFFF,0x00000016, 0x0023F3A0)redis-server.exe!ServiceWorkerThread(c:\\ release \\ redis \\ src \\ win32_interop \\ win32_service.cpp:485)(0x4000B3D0,0x00000000,0x00000000,0x00000000)KERNEL32.DLL!BaseThreadInitThunk(c:\\ release \\ redis \\ src \\ win32_interop \\ win32_service.cpp:485)(0xBB0113B0,0x00000000,0x00000000,0x00000000)ntdll.dll!RtlUserThreadStart(c:\\ release \\ redis \\ src \\ win32_interop \\ win32_service.cpp:485)(0x00000000,0x00000000,0x00000000,0x00000000,0 ntdll.dll!RtlUserThreadStart(c:\\ release \\ redis \\ src \\ win32_interop \\ win32_service.cpp:485)(0x00000000、0x00000000、0x00000000、0x00000000)[33144] 18 Feb 18:18:44.857#=== REDIS BUG报告结束。 Make sure to include from START to END. 确保包括从START到END。 === ===

maxheap is set to 3000mb the server has a total of 64 GB RAM and about 10GB were free maxheap设置为3000mb,服务器总共有64 GB RAM,大约有10GB可用

There is also one more thing , but i'm not sure wether it is really realted to the problem. 还有另外一件事,但是我不确定是否真的解决了这个问题。

Most of the time the problem increases its frequency. 在大多数情况下,问题的发生频率会增加。 Then when I reset the iis of one of the server the problem is gone for hours or days completly. 然后,当我重置其中一台服务器的iis时,问题就消失了好几个小时或几天。 I thought about there may be hanging / stacking signalR queues. 我考虑过可能会挂起/堆叠signalR队列。 But I don't have any further signs that this may be the case. 但我没有其他迹象表明可能是这种情况。

Any hints about that? 有什么暗示吗?

I found the solution it was not related to signalR itself but the client signalR Scaleout is using. 我发现解决方案与signalR本身无关,但正在使用客户端signal Scaleout。

I came out that if you youse the default Microsoft.AspNet.SignalR.Redis package that it includes private refences to an old StackExchange.Redis client. 我得出的结论是,如果您使用的是默认Microsoft.AspNet.SignalR.Redis程序包,则该程序包包括对旧StackExchange.Redis客户端的私有引用。

this client had issue in releasing client connection handles. 该客户端在释放客户端连接句柄时遇到问题。 Now when restarting the IIS or the redis server all this handles are freed up and everything runs again. 现在,当重新启动IIS或Redis服务器时,将释放所有这些句柄,并且所有内容将再次运行。

One solution was to build an own signalR Scaleout stream implementation 一种解决方案是构建自己的signalR Scaleout流实现

the other (which was easier for us) was to just disable the signalR scaleout stream. 另一个(对我们来说更容易)是仅禁用signalR横向扩展流。

All other components which are accessing redis are using ServiceStack.Redis which works fine. 所有其他访问redis的组件都在使用ServiceStack.Redis,它工作正常。

Now about one month later we didn't have any more issues with the redis server. 现在大约一个月后,我们的Redis服务器不再出现任何问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM