我运行的是 Ubuntu 14.04 服务器,上面安装了 Postgresql 9.3。我看到内核消息充斥着 kern.log 和 syslog,每分钟数百行,直到服务器的可用空间不足。我不知道是什么原因造成的。
过去,我曾通过更新到最新内核并重新启动来暂时解决这个问题,但问题很快又出现了。我需要一些帮助吗?
以下是其中一条日志条目:
Sep 28 15:47:32 database kernel: [430051.554606] ------------[ cut here ]------------
Sep 28 15:47:32 database kernel: [430051.554620] WARNING: CPU: 31 PID: 29156 at /build/linux-hFNI9K/linux-3.13.0/net/core/dst.c:285 dst_release+0x45/0x60()
Sep 28 15:47:32 database kernel: [430051.554621] Modules linked in: ppdev vmw_balloon coretemp crct10dif_pclmul crc32_pclmul ghash_clmulni_intel aesni_intel aes_x86_64 lr
w gf128mul glue_helper ablk_helper cryptd serio_raw vmwgfx ttm drm vmw_vmci i2c_piix4 parport_pc lp shpchp mac_hid parport psmouse mptspi mptscsih vmxnet3 mptbase pata_ac
pi floppy
Sep 28 15:47:32 database kernel: [430051.554640] CPU: 31 PID: 29156 Comm: postgres Tainted: G W 3.13.0-63-generic #103-Ubuntu
Sep 28 15:47:32 database kernel: [430051.554642] Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 09/30/2014
Sep 28 15:47:32 database kernel: [430051.554643] 0000000000000009 ffff88081207bb18 ffffffff81723cc0 0000000000000000
Sep 28 15:47:32 database kernel: [430051.554648] ffff88081207bb50 ffffffff8106785d ffff88080e485500 00000000fffffffe
Sep 28 15:47:32 database kernel: [430051.554651] ffff880810c58cc0 0000000000000000 0000000000000000 ffff88081207bb60
Sep 28 15:47:32 database kernel: [430051.554654] Call Trace:
Sep 28 15:47:32 database kernel: [430051.554661] [<ffffffff81723cc0>] dump_stack+0x45/0x56
Sep 28 15:47:32 database kernel: [430051.554665] [<ffffffff8106785d>] warn_slowpath_common+0x7d/0xa0
Sep 28 15:47:32 database kernel: [430051.554667] [<ffffffff8106793a>] warn_slowpath_null+0x1a/0x20
Sep 28 15:47:32 database kernel: [430051.554669] [<ffffffff81630045>] dst_release+0x45/0x60
Sep 28 15:47:32 database kernel: [430051.554673] [<ffffffff81610cf1>] sk_dst_check+0xb1/0xe0
Sep 28 15:47:32 database kernel: [430051.554678] [<ffffffff816c3d1f>] ip6_sk_dst_lookup_flow+0x2f/0x1b0
Sep 28 15:47:32 database kernel: [430051.554682] [<ffffffff816ded3e>] udpv6_sendmsg+0x61e/0xb10
Sep 28 15:47:32 database kernel: [430051.554688] [<ffffffff81246eea>] ? ext4_da_write_end+0xba/0x250
Sep 28 15:47:32 database kernel: [430051.554694] [<ffffffff8114f917>] ? generic_file_buffered_write+0x187/0x250
Sep 28 15:47:32 database kernel: [430051.554699] [<ffffffff81696064>] inet_sendmsg+0x64/0xb0
Sep 28 15:47:32 database kernel: [430051.554704] [<ffffffff81314c07>] ? apparmor_socket_sendmsg+0x17/0x20
Sep 28 15:47:32 database kernel: [430051.554707] [<ffffffff8160e84b>] sock_sendmsg+0x8b/0xc0
Sep 28 15:47:32 database kernel: [430051.554710] [<ffffffff8123c322>] ? ext4_file_write+0xa2/0x3f0
Sep 28 15:47:32 database kernel: [430051.554714] [<ffffffff813398c8>] ? generic_make_request+0x18/0x110
Sep 28 15:47:32 database kernel: [430051.554719] [<ffffffff8172fe74>] ? __do_page_fault+0x204/0x570
Sep 28 15:47:32 database kernel: [430051.554721] [<ffffffff8160ed91>] SYSC_sendto+0x121/0x1c0
Sep 28 15:47:32 database kernel: [430051.554727] [<ffffffff811c0991>] ? __sb_end_write+0x31/0x60
Sep 28 15:47:32 database kernel: [430051.554730] [<ffffffff811be502>] ? vfs_write+0x192/0x1f0
Sep 28 15:47:32 database kernel: [430051.554732] [<ffffffff8160f77e>] SyS_sendto+0xe/0x10
Sep 28 15:47:32 database kernel: [430051.554735] [<ffffffff8173489d>] system_call_fastpath+0x1a/0x1f
Sep 28 15:47:32 database kernel: [430051.554736] ---[ end trace 38c082ce448557d2 ]---
Sep 28 15:47:32 database kernel: [430051.554737] ------------[ cut here ]------------
当我在物理机器上运行数据库时会发生这种情况,而现在当它在 ESX 5.1 上的 VM 中时也会发生这种情况。
以下是有关虚拟机的一些详细信息:
Ubuntu 14.04.3, x86_64
Kernel: 3.13.0-63-generic
Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz, 32 cores
答案1
我在 Ubuntu 16.04 和 Postgresql 9.6 上遇到了非常类似的问题
禁用 ipv6 可以解决问题。
echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf
sudo sysctl -p
注释掉 /etc/hosts 中的 ipv6 行
# The following lines are desirable for IPv6 capable hosts
#::1 localhost ip6-localhost ip6-loopback
#ff02::1 ip6-allnodes
#ff02::2 ip6-allrouters
让 Postgres 监听仅有的在 ipv4 上并将 localhost 替换为 127.0.0.1
现在重新启动 postgres
sudo /etc/init.d/postgresql restart