当我的tshark程序在后台运行时,我使用SFTP协议下载服务器上的资源。此时,tshark报错如下:
$ tshark -ni nflog:40 -w capturefile.pcap -b filesize:131072 -b files:120
Running as user "root" and group "root". This could be dangerous.
Capturing on 'nflog:40'
6654 tshark: Error while capturing packets: Can't receive packet 105:No buffer space available
Please report this to the Wireshark developers.
https://bugs.wireshark.org/
(This is not a crash; please do not report it as such.)
我检查了我的内存使用情况,交换空间非常大。
Tasks: 99 total, 1 running, 98 sleeping, 0 stopped, 0 zombie
%Cpu(s): 34.5 us, 4.9 sy, 0.0 ni, 58.9 id, 0.0 wa, 0.0 hi, 1.7 si, 0.0 st
KiB Mem : 2047960 total, 662668 free, 936364 used, 448928 buff/cache
KiB Swap: 4194296 total, 4011780 free, 182516 used. 903000 avail Mem
我想知道为什么会发生这种情况?
缓冲区大小可以通过-B
参数修改,在我的例子中,我将缓冲区大小从默认的2mb增加到12mb,使用的命令如下:
tshark -ni nflog:40 -B 12-w capturefile.pcap -b filesize:131072 -b files:120