RabbitMQ通用服务器rabbit_disk_monitor终止/ eheap_alloc:无法分配229520字节的内存(类型为“old_heap”)

问题描述:

RabbitMQ崩溃。 RabbitMQ多天(10-15天)正常工作。 我不明白为什么它坠毁。RabbitMQ通用服务器rabbit_disk_monitor终止/ eheap_alloc:无法分配229520字节的内存(类型为“old_heap”)


我使用Erlang的17.0


Erlang的创造转储文件崩溃的RabbitMQ 3.4.0。这表明

eheap_alloc: Cannot allocate 229520 bytes of memory (of type "old_heap"). 

还要注意的是RabbitMQ的发布 - 订阅消息负载是非常低的。 (最大为1-2条信息/秒),RabbitMQ消息会在处理完成后进行处理,所以RabbitMQ一直处于空闲状态。磁盘空间&内存也足够了。

More system info: 
Limiting to approx 8092 file handles (7280 sockets) 
Memory limit set to 6553MB of 16383MB total. 
Disk free limit set to 50MB. 

RabbitMQ日志如下。

=ERROR REPORT==== 18-Jul-2015::04:29:31 === 
** Generic server rabbit_disk_monitor terminating 
** Last message in was update 
** When Server state == {state,"c:/Users/jasmin.joshi/AppData/Roaming/RabbitMQ/db/[email protected]", 
           50000000,28358258688,100,10000, 
           #Ref<0.0.106.70488>,false} 
** Reason for termination == 
** {eacces,[{erlang,open_port, 
        [{spawn,"C:\\Windows\\system32\\cmd.exe /c dir /-C /W \"c:/Users/jasmin.joshi/AppData/Roaming/RabbitMQ/db/[email protected]\""}, 
        [stream,in,eof,hide]], 
        []}, 
      {os,cmd,1,[{file,"os.erl"},{line,204}]}, 
      {rabbit_disk_monitor,get_disk_free,2,[]}, 
      {rabbit_disk_monitor,internal_update,1,[]}, 
      {rabbit_disk_monitor,handle_info,2,[]}, 
      {gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,599}]}, 
      {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]} 

=INFO REPORT==== 18-Jul-2015::04:29:31 === 
Disabling disk free space monitoring on unsupported platform: 
{{'EXIT',{eacces,[{erlang,open_port, 
          [{spawn,"C:\\Windows\\system32\\cmd.exe /c dir /-C /W \"c:/Users/jasmin.joshi/AppData/Roaming/RabbitMQ/db/[email protected]\""}, 
          [stream,in,eof,hide]], 
          []}, 
        {os,cmd,1,[{file,"os.erl"},{line,204}]}, 
        {rabbit_disk_monitor,get_disk_free,2,[]}, 
        {rabbit_disk_monitor,init,1,[]}, 
        {gen_server,init_it,6,[{file,"gen_server.erl"},{line,306}]}, 
        {proc_lib,init_p_do_apply,3, 
          [{file,"proc_lib.erl"},{line,239}]}]}}, 
17179336704} 

=INFO REPORT==== 18-Jul-2015::04:29:31 === 
Disabling disk free space monitoring on unsupported platform: 
{{'EXIT',{eacces,[{erlang,open_port, 
          [{spawn,"C:\\Windows\\system32\\cmd.exe /c dir /-C /W \"c:/Users/jasmin.joshi/AppData/Roaming/RabbitMQ/db/[email protected]\""}, 
          [stream,in,eof,hide]], 
          []}, 
        {os,cmd,1,[{file,"os.erl"},{line,204}]}, 
        {rabbit_disk_monitor,get_disk_free,2,[]}, 
        {rabbit_disk_monitor,init,1,[]}, 
        {gen_server,init_it,6,[{file,"gen_server.erl"},{line,306}]}, 
        {proc_lib,init_p_do_apply,3, 
          [{file,"proc_lib.erl"},{line,239}]}]}}, 
17179336704} 

=CRASH REPORT==== 18-Jul-2015::04:29:31 === 
    crasher: 
    initial call: rabbit_disk_monitor:init/1 
    pid: <0.167.0> 
    registered_name: rabbit_disk_monitor 
    exception exit: {eacces, 
         [{erlang,open_port, 
          [{spawn, 
            "C:\\Windows\\system32\\cmd.exe /c dir /-C /W \"c:/Users/jasmin.joshi/AppData/Roaming/RabbitMQ/db/[email protected]\""}, 
           [stream,in,eof,hide]], 
          []}, 
         {os,cmd,1,[{file,"os.erl"},{line,204}]}, 
         {rabbit_disk_monitor,get_disk_free,2,[]}, 
         {rabbit_disk_monitor,internal_update,1,[]}, 
         {rabbit_disk_monitor,handle_info,2,[]}, 
         {gen_server,handle_msg,5, 
          [{file,"gen_server.erl"},{line,599}]}, 
         {proc_lib,init_p_do_apply,3, 
          [{file,"proc_lib.erl"},{line,239}]}]} 
     in function gen_server:terminate/6 (gen_server.erl, line 746) 
    ancestors: [rabbit_disk_monitor_sup,rabbit_sup,<0.140.0>] 
    messages: [] 
    links: [<0.166.0>] 
    dictionary: [] 
    trap_exit: false 
    status: running 
    heap_size: 4185 
    stack_size: 27 
    reductions: 481081978 
    neighbours: 

=SUPERVISOR REPORT==== 18-Jul-2015::04:29:31 === 
    Supervisor: {local,rabbit_disk_monitor_sup} 
    Context: child_terminated 
    Reason:  {eacces, 
        [{erlang,open_port, 
          [{spawn, 
           "C:\\Windows\\system32\\cmd.exe /c dir /-C /W \"c:/Users/jasmin.joshi/AppData/Roaming/RabbitMQ/db/[email protected]\""}, 
          [stream,in,eof,hide]], 
          []}, 
         {os,cmd,1,[{file,"os.erl"},{line,204}]}, 
         {rabbit_disk_monitor,get_disk_free,2,[]}, 
         {rabbit_disk_monitor,internal_update,1,[]}, 
         {rabbit_disk_monitor,handle_info,2,[]}, 
         {gen_server,handle_msg,5, 
          [{file,"gen_server.erl"},{line,599}]}, 
         {proc_lib,init_p_do_apply,3, 
          [{file,"proc_lib.erl"},{line,239}]}]} 
    Offender: [{pid,<0.167.0>}, 
        {name,rabbit_disk_monitor}, 
        {mfargs,{rabbit_disk_monitor,start_link,[50000000]}}, 
        {restart_type,{transient,1}}, 
        {shutdown,4294967295}, 
        {child_type,worker}] 


=CRASH REPORT==== 18-Jul-2015::04:29:31 === 
    crasher: 
    initial call: rabbit_disk_monitor:init/1 
    pid: <0.24989.51> 
    registered_name: [] 
    exception exit: unsupported_platform 
     in function gen_server:init_it/6 (gen_server.erl, line 322) 
    ancestors: [rabbit_disk_monitor_sup,rabbit_sup,<0.140.0>] 
    messages: [] 
    links: [<0.166.0>] 
    dictionary: [] 
    trap_exit: false 
    status: running 
    heap_size: 1598 
    stack_size: 27 
    reductions: 650 
    neighbours: 

=SUPERVISOR REPORT==== 18-Jul-2015::04:29:31 === 
    Supervisor: {local,rabbit_disk_monitor_sup} 
    Context: start_error 
    Reason:  unsupported_platform 
    Offender: [{pid,<0.167.0>}, 
        {name,rabbit_disk_monitor}, 
        {mfargs,{rabbit_disk_monitor,start_link,[50000000]}}, 
        {restart_type,{transient,1}}, 
        {shutdown,4294967295}, 
        {child_type,worker}] 


=CRASH REPORT==== 18-Jul-2015::04:29:31 === 
    crasher: 
    initial call: rabbit_disk_monitor:init/1 
    pid: <0.24991.51> 
    registered_name: [] 
    exception exit: unsupported_platform 
     in function gen_server:init_it/6 (gen_server.erl, line 322) 
    ancestors: [rabbit_disk_monitor_sup,rabbit_sup,<0.140.0>] 
    messages: [] 
    links: [<0.166.0>] 
    dictionary: [] 
    trap_exit: false 
    status: running 
    heap_size: 1598 
    stack_size: 27 
    reductions: 650 
    neighbours: 

=SUPERVISOR REPORT==== 18-Jul-2015::04:29:31 === 
    Supervisor: {local,rabbit_disk_monitor_sup} 
    Context: start_error 
    Reason:  unsupported_platform 
    Offender: [{pid,{restarting,<0.167.0>}}, 
        {name,rabbit_disk_monitor}, 
        {mfargs,{rabbit_disk_monitor,start_link,[50000000]}}, 
        {restart_type,{transient,1}}, 
        {shutdown,4294967295}, 
        {child_type,worker}] 
+0

我也面临同样的问题。任何帮助,将不胜感激 –

从错误信息,RabbitMQ的不能打开多个文件,由于系统的限制。 您可以将最大打开文件数设置为较高值以避免该问题。

https://serverfault.com/questions/249477/windows-server-2008-r2-max-open-files-limit

这里有两个不相关的错误:一个是虚拟机内存分配失败时。另一个是磁盘空间监视器终止。磁盘空间监视器是可选的,并且在一些不太常见的平台上或者具有特定的安全限制的情况下,已知会失败这并不会导致虚拟机停机,并且与堆分配失败无关。

堆分配失败通常归结为两种最常见的情况:

  • 固定在二郎山17.x一个已知错误(不记得哪个特定的补丁发布,所以使用17.5)
  • 你在64位操作系统上运行32位Erlang/OTP。

陈宇对EACCESS系统调用错误的评论是正确的。