macfanctld keeps stderr open when daemonizing

Bug #1342740 reported by Brian Candler on 2014-07-16
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
macfanctld
Undecided
Unassigned

Bug Description

When installing the package 'macfanctld' it automatically starts the daemon (/usr/sbin/macfanctld)

However, the daemon child process inherits stderr and doesn't close it. As a result, any package which forks a child apt process and passes pipes for stdout/stderr will wait indefinitely for them to be closed.

I cam across this problem using ansible:

~~~
- hosts: localhost
  tasks:
  - apt: pkg=macfanctld state=absent purge=yes
  - apt: pkg=macfanctld state=present
~~~

This consistently hangs at the second operation. At this point, ps shows:

~~~
root 11471 0.0 0.0 64956 2112 pts/1 S+ 13:16 0:00 sudo ansible-playbook tmp.yml
root 11472 2.1 0.1 85664 17160 pts/1 S+ 13:16 0:00 /usr/bin/python /usr/bin/ansible-playbook tmp.yml
root 11751 0.0 0.0 4444 648 pts/1 S+ 13:16 0:00 /bin/sh -c /usr/bin/python /home/nsrc/.ansible/tmp/ansible-tmp-1405516587.94-157111181416778/apt; rm -rf /home/nsrc/.ansible/tmp/ansible-tmp-1405516587.94-157111181416778/ >/dev/null 2>&1
root 11752 9.7 0.4 120508 71432 pts/1 S+ 13:16 0:00 /usr/bin/python /home/nsrc/.ansible/tmp/ansible-tmp-1405516587.94-157111181416778/apt
root 11756 13.2 0.0 0 0 pts/1 Z+ 13:16 0:00 [apt-get] <defunct>
root 12000 0.5 0.0 4616 788 ? Ss 13:16 0:00 /usr/sbin/macfanctld
~~~

Notice that apt-get process has completed, but the parent process is still waiting for it to close its stdout or stderr.

If you manually kill the macfanctld process, the ansible process completes successfully.

You can demonstrate this even more directly like this:

~~~
# ( service macfanctld start 2>&1 ) | cat
 * Starting Apple MacBook (Pro) fan control daemon macfanctld
   ...done.
<< hangs at this point >>
~~~

Again, killing macfanctld from another terminal allows the command to complete.

ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: macfanctld 0.6+repack1-1
ProcVersionSignature: Ubuntu 3.13.0-30.55-generic 3.13.11.2
Uname: Linux 3.13.0-30-generic x86_64
ApportVersion: 2.14.1-0ubuntu3.2
Architecture: amd64
Date: Wed Jul 16 13:55:04 2014
Dependencies:
 gcc-4.9-base 4.9-20140406-0ubuntu1
 libc6 2.19-0ubuntu6
 libgcc1 1:4.9-20140406-0ubuntu1
 multiarch-support 2.19-0ubuntu6
InstallationDate: Installed on 2014-07-16 (0 days ago)
InstallationMedia: Ubuntu-Server 14.04 LTS "Trusty Tahr" - Release amd64 (20140416.2)
ProcEnviron:
 LANGUAGE=en_GB:en
 TERM=xterm
 PATH=(custom, no user)
 LANG=en_GB.UTF-8
 SHELL=/bin/bash
SourcePackage: macfanctld
UpgradeStatus: No upgrade log present (probably fresh install)

Naël (nathanael-naeri) wrote :

Bugs are tracked in the project this package comes from (via a Debian repack). However they aren't fixed anyway since the project currently hasn't a developer any more.

affects: macfanctld (Ubuntu) → macfanctld
Naël (nathanael-naeri) wrote :

Confirming this using Jason Heeris's macfanctld package (made from the 0.6+repack1-1 package used by the OP and available in ppa:detly/mactel-utils), on Ubuntu 14.04 LTS.

# ( service macfanctld start 2>&1 ) | cat
<< hangs at this point >>
# ( service macfanctld restart 2>&1 ) | cat
 * Restarting Start the macfanctl daemon macfanctld
   ...done.
<< hangs at this point >>

macfanctld is indeed (re)started, and killing it from another terminal allows the command to complete.

DistroRelease: Ubuntu 14.04
Package: macfanctld 0.7.detly-2~trusty
Uname: Linux 3.19.0-51-generic x86_64

information type: Public → Public Security
information type: Public Security → Public
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers