iperf forks and loops endlessly in daemon mode

Bug #1260893 reported by Ken Sharp
32
This bug affects 6 people
Affects Status Importance Assigned to Milestone
iperf (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

When initially launched in daemon (-D) mode, iperf will sit quietly and wait. However, once a test is performed iperf forks a new thread and this process never exits and continues to run at 100% CPU until it is killed.

It also cannot be killed with SIGTERM (although it does acknowledge the attempt once by asking you to do it again if you want to kill it) and has to be killed with SIGKILL.

Very easy to recreate:

user@server $ iperf -sD

user@client $ iperf -c server

htop screenshot attached.

Tested on Precise, Saucy, Trusty and Debian Testing, on i386, amd64 and armel.

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: iperf 2.0.5-2.1
ProcVersionSignature: Ubuntu 3.8.0-33.48~precise1-generic 3.8.13.11
Uname: Linux 3.8.0-33-generic i686
ApportVersion: 2.0.1-0ubuntu17.6
Architecture: i386
Date: Fri Dec 13 23:30:08 2013
InstallationMedia: Ubuntu-Server 12.04.1 LTS "Precise Pangolin" - Release i386 (20120817.3)
MarkForUpload: True
ProcEnviron:
 LANGUAGE=en_GB:en
 TERM=xterm
 PATH=(custom, no user)
 LANG=en_GB.UTF-8
 SHELL=/bin/bash
SourcePackage: iperf
UpgradeStatus: No upgrade log present (probably fresh install)

Related branches

Revision history for this message
Ken Sharp (kennybobs) wrote :
Revision history for this message
Ken Sharp (kennybobs) wrote :
Revision history for this message
Michael F. Miller (mikem1355) wrote :

This may be already known but from the iperf man page:

BUGS
       Exit statuses are inconsistent. The threading implementation is rather
       heinous.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in iperf (Ubuntu):
status: New → Confirmed
Revision history for this message
Rod Smith (rodsmith) wrote :

The problem was caused by starting a thread and then forking the program as part of daemonizing it. This resulted in the thread no longer communicating correctly with the forked main program. See here for more information:

http://www.linuxprogrammingblog.com/threads-and-fork-think-twice-before-using-them

I've created a patch that fixes this problem by creating the daemon fork prior to creating any threads. This has worked OK in my limited testing, but I recommend additional testing before releasing this version on an unsuspecting world.

Note also that iperf2 appears to be semi-deprecated in favor of iperf3, which is not yet in Ubuntu. From the iperf2 Sourceforge page: This is the old, Iperf 2 code base. The primary development has moved to Iperf 3 which is hosted on Google Code. You can find it here: http://code.google.com/p/iperf/." It appears that efforts are underway to bring iperf3 into Debian:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=739921

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Patch to fix this bug" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
Rod Smith (rodsmith) wrote :

I've submitted this patch upstream:

https://sourceforge.net/p/iperf/patches/28/

tags: added: server-hwe
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

The patch for this bug is present in the current utopic iperf package version (2.0.5+dfsg1-2). Can anyone upgrade the package in utopic and confirm this issue is fixed?

Changed in iperf (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Rod Smith (rodsmith) wrote :

I just tested with Utopic, and it seems to be fixed there.

Revision history for this message
Denis (napalmded) wrote :

how i find new deb package with this fix ? compile somebody please

Revision history for this message
Lévai Tamás (lt) wrote :

It's still an issue in Trusty. The later version (2.0.5+dfsg1-2) includes the required fix and works fine on Trusty.
I am not familiar with the LTS package upgrading policies, but could anyone upgrade the Trusty version (2.0.5-3) too?

Revision history for this message
Jeff Lane  (bladernr) wrote : Re: [Bug 1260893] Re: iperf forks and loops endlessly in daemon mode

On Thu, Feb 25, 2016 at 7:51 AM, Lévai Tamás <email address hidden> wrote:
> It's still an issue in Trusty. The later version (2.0.5+dfsg1-2) includes the required fix and works fine on Trusty.
> I am not familiar with the LTS package upgrading policies, but could anyone upgrade the Trusty version (2.0.5-3) too?

iperf3 also does not suffer from this and is available in the
trusty-backports repo:
iperf3:
  Installed: (none)
  Candidate: 3.0.7-1~ubuntu14.04.1
  Version table:
     3.0.7-1~ubuntu14.04.1 0
        100 http://us.archive.ubuntu.com/ubuntu/ trusty-backports/universe amd64

--
"Entropy isn't what it used to be."

Jeff Lane -
Server Certification Lead, Warrior Poet, Biker, Lover of Pie
Phone: 919-442-8649
Ubuntu Ham: W4KDH Freenode IRC: bladernr or bladernr_
gpg: 1024D/3A14B2DD 8C88 B076 0DD7 B404 1417 C466 4ABD 3635 3A14 B2DD

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.