我運行 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 上的虛擬機器中執行資料庫時,都會發生這種情況。
以下是有關虛擬機器的一些詳細資訊:
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