【问题标题】:Solr Replication leaking some memory?Solr 复制泄漏一些内存?
【发布时间】:2014-08-07 01:37:35
【问题描述】:

最近我们发现我们的 Linux 服务器上的 JBoss 进程由于高内存消耗(大约 2.3 GB)被操作系统关闭。这是转储:

RPC: fragment too large: 0x00800103
RPC: multiple fragments per record not supported
RPC: fragment too large: 0x00800103
RPC: multiple fragments per record not supported
RPC: fragment too large: 0x00800103
RPC: multiple fragments per record not supported
RPC: fragment too large: 0x00800103
RPC: multiple fragments per record not supported
RPC: fragment too large: 0x00800103
RPC: multiple fragments per record not supported
RPC: fragment too large: 0x00800103
RPC: multiple fragments per record not supported
RPC: fragment too large: 0x00800103
RPC: multiple fragments per record not supported
java invoked oom-killer: gfp_mask=0x201da, order=0, oom_adj=0, oom_score_adj=0
java cpuset=/ mems_allowed=0
Pid: 11445, comm: java Not tainted 2.6.32-431.el6.x86_64 #1
Call Trace:
 [<ffffffff810d05b1>] ? cpuset_print_task_mems_allowed+0x91/0xb0
 [<ffffffff81122960>] ? dump_header+0x90/0x1b0
 [<ffffffff8122798c>] ? security_real_capable_noaudit+0x3c/0x70
 [<ffffffff81122de2>] ? oom_kill_process+0x82/0x2a0
 [<ffffffff81122d21>] ? select_bad_process+0xe1/0x120
 [<ffffffff81123220>] ? out_of_memory+0x220/0x3c0
 [<ffffffff8112fb3c>] ? __alloc_pages_nodemask+0x8ac/0x8d0
 [<ffffffff81167a9a>] ? alloc_pages_current+0xaa/0x110
 [<ffffffff8111fd57>] ? __page_cache_alloc+0x87/0x90
 [<ffffffff8111f73e>] ? find_get_page+0x1e/0xa0
 [<ffffffff81120cf7>] ? filemap_fault+0x1a7/0x500
 [<ffffffff8114a084>] ? __do_fault+0x54/0x530
 [<ffffffff810afa17>] ? futex_wait+0x227/0x380
 [<ffffffff8114a657>] ? handle_pte_fault+0xf7/0xb00
 [<ffffffff8114b28a>] ? handle_mm_fault+0x22a/0x300
 [<ffffffff8104a8d8>] ? __do_page_fault+0x138/0x480
 [<ffffffff81527910>] ? thread_return+0x4e/0x76e
 [<ffffffff8152d45e>] ? do_page_fault+0x3e/0xa0
 [<ffffffff8152a815>] ? page_fault+0x25/0x30
Mem-Info:
Node 0 DMA per-cpu:
CPU    0: hi:    0, btch:   1 usd:   0
CPU    1: hi:    0, btch:   1 usd:   0
Node 0 DMA32 per-cpu:
CPU    0: hi:  186, btch:  31 usd: 178
CPU    1: hi:  186, btch:  31 usd:  30
Node 0 Normal per-cpu:
CPU    0: hi:  186, btch:  31 usd: 174
CPU    1: hi:  186, btch:  31 usd: 194
active_anon:113513 inactive_anon:184789 isolated_anon:0
 active_file:21 inactive_file:0 isolated_file:0
 unevictable:0 dirty:10 writeback:0 unstable:0
 free:17533 slab_reclaimable:4706 slab_unreclaimable:8059
 mapped:64 shmem:4 pagetables:3064 bounce:0
Node 0 DMA free:15696kB min:248kB low:308kB high:372kB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:15300kB mlocked:0kB dirty:0kB writeback:0kB mapped:0kB shmem:0kB slab_reclaimable:0kB slab_unreclaimable:0kB kernel_stack:0kB pagetables:0kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? yes
lowmem_reserve[]: 0 3000 4010 4010
Node 0 DMA32 free:41740kB min:50372kB low:62964kB high:75556kB active_anon:200648kB inactive_anon:216504kB active_file:20kB inactive_file:52kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:3072160kB mlocked:0kB dirty:8kB writeback:0kB mapped:168kB shmem:0kB slab_reclaimable:3720kB slab_unreclaimable:2476kB kernel_stack:512kB pagetables:516kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:108 all_unreclaimable? yes
lowmem_reserve[]: 0 0 1010 1010
Node 0 Normal free:12696kB min:16956kB low:21192kB high:25432kB active_anon:253404kB inactive_anon:522652kB active_file:64kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:1034240kB mlocked:0kB dirty:32kB writeback:0kB mapped:88kB shmem:16kB slab_reclaimable:15104kB slab_unreclaimable:29760kB kernel_stack:3704kB pagetables:11740kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:146 all_unreclaimable? yes
lowmem_reserve[]: 0 0 0 0
Node 0 DMA: 4*4kB 2*8kB 3*16kB 4*32kB 2*64kB 0*128kB 0*256kB 0*512kB 1*1024kB 1*2048kB 3*4096kB = 15696kB
Node 0 DMA32: 341*4kB 277*8kB 209*16kB 128*32kB 104*64kB 54*128kB 33*256kB 13*512kB 0*1024kB 1*2048kB 0*4096kB = 41740kB
Node 0 Normal: 2662*4kB 0*8kB 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 1*2048kB 0*4096kB = 12696kB
64603 total pagecache pages
64549 pages in swap cache
Swap cache stats: add 3763837, delete 3699288, find 1606527/1870160
Free swap  = 0kB
Total swap = 1048568kB
1048560 pages RAM
67449 pages reserved
1061 pages shared
958817 pages non-shared
[ pid ]   uid  tgid total_vm      rss cpu oom_adj oom_score_adj name
[  419]     0   419     2662        1   1     -17         -1000 udevd
[  726]     0   726     2697        1   1     -17         -1000 udevd
[ 1021]     0  1021     4210       40   1       0             0 vmware-guestd
[ 1238]     0  1238    23294       28   1     -17         -1000 auditd
[ 1254]    65  1254   112744      203   1       0             0 nslcd
[ 1267]     0  1267    62271      123   1       0             0 rsyslogd
[ 1279]     0  1279     2705       32   1       0             0 irqbalance
[ 1293]    32  1293     4744       16   1       0             0 rpcbind
[ 1311]    29  1311     5837        2   0       0             0 rpc.statd
[ 1422]    81  1422     5874       36   0       0             0 dbus-daemon
[ 1451]     0  1451     1020        1   0       0             0 acpid
[ 1460]    68  1460     9995      129   0       0             0 hald
[ 1461]     0  1461     5082        2   1       0             0 hald-runner
[ 1490]     0  1490     5612        2   1       0             0 hald-addon-inpu
[ 1503]    68  1503     4484        2   0       0             0 hald-addon-acpi
[ 1523]     0  1523   134268       53   0       0             0 automount
[ 1540]     0  1540     1566        1   0       0             0 mcelog
[ 1552]     0  1552    16651       27   1     -17         -1000 sshd
[ 1560]     0  1560     5545       26   0       0             0 xinetd
[ 1568]    38  1568     8202       33   0       0             0 ntpd
[ 1584]     0  1584    21795       56   0       0             0 sendmail
[ 1592]    51  1592    19658       32   0       0             0 sendmail
[ 1601]     0  1601    29324       21   1       0             0 crond
[ 1612]     0  1612     5385        5   1       0             0 atd
[ 1638]     0  1638     1016        2   0       0             0 mingetty
[ 1640]     0  1640     1016        2   1       0             0 mingetty
[ 1642]     0  1642     1016        2   0       0             0 mingetty
[ 1644]     0  1644     2661        1   1     -17         -1000 udevd
[ 1645]     0  1645     1016        2   0       0             0 mingetty
[ 1647]     0  1647     1016        2   1       0             0 mingetty
[ 1649]     0  1649     1016        2   1       0             0 mingetty
[25003]     0 25003    26827        1   1       0             0 rpc.rquotad
[25007]     0 25007     5440        2   1       0             0 rpc.mountd
[25045]     0 25045     5773        2   1       0             0 rpc.idmapd
[31756]     0 31756    43994       12   0       0             0 httpd
[31758]    48 31758    45035      205   0       0             0 httpd
[31759]    48 31759    45035      210   1       0             0 httpd
[31760]    48 31760    45035      201   1       0             0 httpd
[31761]    48 31761    45068      211   1       0             0 httpd
[31762]    48 31762    45068      199   0       0             0 httpd
[31763]    48 31763    45035      196   0       0             0 httpd
[31764]    48 31764    45068      191   1       0             0 httpd
[31765]    48 31765    45035      206   1       0             0 httpd
[ 1893]     0  1893    41344        2   0       0             0 su
[ 1896]   500  1896    26525        2   0       0             0 standalone.sh
[ 1957]   500  1957   570217    81589   0       0             0 java
[10739]     0 10739    41344        2   0       0             0 su
[10742]   500 10742    26525        2   0       0             0 standalone.sh
[10805]   500 10805   576358    77163   0       0             0 java
[13378]     0 13378    41344        2   0       0             0 su
[13381]   500 13381    26525        2   1       0             0 standalone.sh
[13442]   500 13442   561881    73430   1       0             0 java
Out of memory: Kill process 10805 (java) score 141 or sacrifice child
Killed process 10805, UID 500, (java) total-vm:2305432kB, anon-rss:308648kB, file-rss:4kB

它在凌晨 04:00 左右关闭,当时除了 Solr 复制之外,服务器上没有用户,也没有任何活动。是主节点失败了,我们的从节点每分钟都在 ping 它。这是复制配置:

<requestHandler name="/replication" class="solr.ReplicationHandler" >
       <lst name="master">
         <str name="enable">${solr.enable.master:false}</str>
         <str name="replicateAfter">commit</str>
         <str name="replicateAfter">startup</str>
         <str name="confFiles">schema.xml,stopwords.txt</str>
       </lst>
       <lst name="slave">
         <str name="enable">${solr.enable.slave:false}</str>
         <str name="masterUrl">${solr.master.url:http://localhost:8080/solr/cstb}</str>
         <str name="pollInterval">00:00:60</str>
       </lst>
     </requestHandler>

由于没有用户活动,因此索引没有变化,因此 Solr 实际上不应该做任何事情(我假设)。

配置文件中的一些其他值:

  <indexDefaults>
    <useCompoundFile>false</useCompoundFile>
    <mergeFactor>10</mergeFactor>
    <ramBufferSizeMB>32</ramBufferSizeMB>
    <maxFieldLength>10000</maxFieldLength>
    <writeLockTimeout>1000</writeLockTimeout>
    <lockType>native</lockType>
  </indexDefaults>

  <mainIndex>
    <useCompoundFile>false</useCompoundFile>
    <ramBufferSizeMB>32</ramBufferSizeMB>
    <mergeFactor>10</mergeFactor>
    <unlockOnStartup>false</unlockOnStartup>
    <reopenReaders>true</reopenReaders>
    <deletionPolicy class="solr.SolrDeletionPolicy">
      <str name="maxCommitsToKeep">1</str>
      <str name="maxOptimizedCommitsToKeep">0</str>
    </deletionPolicy>
    <infoStream file="INFOSTREAM.txt">false</infoStream>
  </mainIndex>

  <queryResultWindowSize>20</queryResultWindowSize>
  <queryResultMaxDocsCached>200</queryResultMaxDocsCached>

那么,有没有人遇到过类似的情况或对此有任何想法?我们正在使用 Solr 3.5。

【问题讨论】:

  • 您能分享一下您的 JVM 的堆大小配置、Linux 类型、操作系统版本和硬件配置(特别是内存)吗?
  • @JohnPetrone 没有什么特别的(不幸的是,我没有触手可及的所有系统设置)。 jboss 的最大堆大小设置为 512 MB。而且我可能以错误的方式说明了这一点:所有 jvm 进程的总内存消耗为 2.3GB,而不是 jboss。

标签: java solr out-of-memory jboss7.x replication


【解决方案1】:

您遇到了导致 Linux 终止高内存使用进程的低内存条件:

Out of memory: Kill process 10805 (java) score 141 or sacrifice child

这被称为内存不足杀手或 OOM。鉴于您仅使用 512MB 用于 JVM 堆(我认为对于任何重要容量的生产 Solr 实例来说太低了),您没有很多选择,因为您无法减少堆以释放更多操作系统内存。

你可以尝试的事情:

  1. 升级到具有更多内存的更大服务器。这将是我的第一个建议 - 您只是没有足够的可用内存。

  2. 将任何其他生产代码移动到另一个系统。你没有
    提及您是否在此服务器上运行其他任何东西,但我会 把我能移到别处的任何东西。我怀疑在这里没有太多收获 您的系统很小,但每一点
    有帮助。

  3. 尝试将 OOM 杀手调整得不那么严格 - 做起来并不容易,而且我不知道由于整体服务器规模较小,您会获得什么,但您始终可以进行试验:

https://unix.stackexchange.com/questions/58872/how-to-set-oom-killer-adjustments-for-daemons-permanently

http://backdrift.org/how-to-create-oom-killer-exceptions

http://www.oracle.com/technetwork/articles/servers-storage-dev/oom-killer-1911807.html

【讨论】:

  • 我同意你的第一个选项。我们的 Linux 服务器(幸运的是,它不是生产服务器)有 4 GB 内存,并包含 3 个用于不同系统(培训、测试、集成)的 jboss,每个起始大小为 512 MB。服务器本身压力不大,相当简单。但是我们的管理员说他不会添加更多内存,因为在打开复制之前,一切正常。所以,我想知道 Solr 是怎么回事,它是否泄漏了一些内存或其他什么,或者存在某种 GC 错误(我实际上在 Solr 邮件列表中找到了一个参考,但它应该在我们的 jvm 中修复)
  • 不,不是错误或内存泄漏——你很幸运。你在极限运行,当操作系统决定它需要内存时,OOM 杀手将通过一个设定的进程来杀死一个高内存用户。
猜你喜欢
  • 2011-07-31
  • 2020-06-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-05-25
  • 2017-04-17
  • 1970-01-01
  • 2012-01-12
相关资源
最近更新 更多