stund uses up more cpu than it should

Bug #255967 reported by Marc Horowitz
4
Affects Status Importance Assigned to Milestone
stun (Ubuntu)
Undecided
Unassigned

Bug Description

Binary package hint: stun

stund uses 5-8% of the CPU on a pretty fast machine (xen vm on 1/8 of a quad core amd box). Looking at the code, the inner loop looks like this:

   struct timeval tv;
   tv.tv_sec = 0;
   tv.tv_usec = 1000;

   int e = select( maxFd, &fdSet, NULL,NULL, &tv );

I don't see any reason the select timeout should be so short. I haven't tested increasing it, but based on the strace output, I'd be shocked if making it larger didn't help.

ProblemType: Bug
Architecture: i386
Date: Fri Aug 8 01:45:49 2008
Dependencies:
 libgcc1 1:4.2.3-2ubuntu7
 libstdc++6 4.2.3-2ubuntu7
 gcc-4.2-base 4.2.3-2ubuntu7
 libc6 2.7-10ubuntu3
DistroRelease: Ubuntu 8.04
NonfreeKernelModules: openafs nvidia
Package: stun 0.96.dfsg-5
PackageArchitecture: i386
ProcEnviron:
 PATH=/home/username/bin:/usr/local/bin:/usr/pkg/bin:/usr/X11R6/bin:/usr/openwin/bin:/usr/bin:/bin:/usr/local/sbin:/usr/pkg/sbin:/usr/sbin:/sbin
 LANG=en_US.UTF-8
 SHELL=/bin/tcsh
SourcePackage: stun
Uname: Linux 2.6.24-19-generic i686

Revision history for this message
Marius Karthaus (bugs-karthaus) wrote :

I can confirm both the bug and the solution.

If you look at stun using powertop it shows a lot of useless wakeups because of this loop. I've recompiled the package with modified stun.cxx (see diff code below) and now it does not hog the system. It still works perfectly on our production VOIP server. Please fix.

Regards,
Marius Karthaus

patch:

1408c1408
< tv.tv_usec = 1000000;
---
> tv.tv_usec = 1000;

Changed in stun (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers