Re: High cpu usage bug in network-manager-openvpn (patch)



Or maybe I should investigate why the socket to localhost:1194 got
closed in the first place, I mean, is this a normal behavior? But as I'm
not familiar with openvpn internals, I have chose to fix it in the easy
way.

PS, please kindly put me in the CC: as I am not subscribed to the list,
thanks!

"Bao Haojun" <hjbao marvell com> writes:

> Hi, all
>
> I'm using debian testing, and the version is
> network-manager-openvpn-0.9.4.0.
>
> I can connect to my openvpn server successfully, but after a while, my
> CPU usage got high:
>
>       PID USER      PRI  NI  VIRT   RES   SHR S CPU% MEM%   TIME+  Command
>     11039 root       20   0 74032  3576  2932 R 100.  0.0  4:35.72 /usr/lib/NetworkManager/nm-openvpn-service
>
> Strace shows it's repeatedly reading EOF from fd 7, 
>
>     [pid 11039] poll([{fd=4, events=POLLIN}, {fd=3, events=POLLIN}, {fd=7, events=POLLIN}], 3, -1) = 2 ([{fd=4, revents=POLLIN}, {fd=7, revents=POLLIN}])
>     [pid 11039] read(4, "\2\0\0\0\0\0\0\0", 16) = 8
>     [pid 11039] write(4, "\1\0\0\0\0\0\0\0", 8) = 8
>     [pid 11039] read(7, "", 1024)           = 0
>     [pid 11039] write(4, "\1\0\0\0\0\0\0\0", 8) = 8
>     [pid 11039] poll([{fd=4, events=POLLIN}, {fd=3, events=POLLIN}, {fd=7, events=POLLIN}], 3, -1) = 2 ([{fd=4, revents=POLLIN}, {fd=7, revents=POLLIN}])
>     [pid 11039] read(4, "\2\0\0\0\0\0\0\0", 16) = 8
>     [pid 11039] write(4, "\1\0\0\0\0\0\0\0", 8) = 8
>     [pid 11039] read(7, "", 1024)           = 0
>     [pid 11039] write(4, "\1\0\0\0\0\0\0\0", 8) = 8
>
> which is a socket connected to localhost:1194 and in the CLOSE_WAIT
> state:
>
>     # output from "ls -l /proc/pid/fd"
>     lrwx------ 1 root root 64 Oct 11 14:02 /proc/11039/fd/7 -> socket:[1024147]
>
>     # output from "sudo netstat -a -p -n |grep 11039"
>     tcp        0      0 127.0.0.1:43056         127.0.0.1:1194          CLOSE_WAIT  11039/nm-openvpn-se
>
> My fix for this problem is to stop watching that IO channel because when
> EOF occur, the poll will always return readable immediately, thus
> creating busy loop.
>
> Patch is attached, please help review.

-- 
All the best

 Bao Haojun


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]