Openvpn tap uses 99% cpu time
Luigi Rizzo
rizzo at icir.org
Wed Mar 14 15:01:25 UTC 2007
On Wed, Mar 14, 2007 at 03:48:38PM +0200, Vlad GALU wrote:
> On 3/14/07, Emile Coetzee <EmileC at clarotech.co.za> wrote:
> > Since the latest updates to sys/net/if_tap.c (I suspect) in 6.2-STABLE
> > my openvpn tap server is using up all available CPU time (99%)
> > effectively killing the box.
...
> It usually happens when OpenVPN is told to retry connecting to the
> remote endpoint and the remote endpoint isn't accessible due to
> network conditions. It happens the same even on Windows.
something that often does the job is putting a usleep(1)
right after the offending syscall (e.g. a select() returning
with an error, or the like).
This deschedules the current process for at least one tick,
which is normally enough to change the busy-wait loop into one
that still is busy-wait but only takes a tiny fraction of the cpu.
Of course you want to usleep() only if there is a real error condition.
cheers
luigi
More information about the freebsd-stable
mailing list