Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 308931 - net-misc/stunnel pid-file creation too slow; init file claims failure
Summary: net-misc/stunnel pid-file creation too slow; init file claims failure
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Lance Albertson (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-11 04:47 UTC by Preston Crow
Modified: 2010-06-21 00:48 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Preston Crow 2010-03-11 04:47:43 UTC
When running:
  /etc/init.d/stunnel start
It complains:
stunnel         | * Starting stunnel ...
stunnel         | *    error starting: /etc/stunnel/stunnel.conf          [ !! ]

The process is created, and it works correctly.  Digging into the init script I find that the error indicates that it can't find the pid file as specified in the configuration file.  Checking in the file system, I see that it was created.  Apparently stunnel will fork into the background before creating the pid file, so there's a race condition that on my system is causing it to consistently fail that check.  If I add another display message after starting the daemon but before checking for the pid file, the script reports success.

While the correct fix is to push this upstream to eliminate the race condition in the creation of the pid file, a workaround is to update the check for the pid file to first sleep a half-second if the file isn't there.  This change makes it work for me:

            elif ${DAEMON} ${ARGS} ; then
                if ! test -f ${CHROOT}/${PIDFILE} ; then
		    sleep 0.5s # give the daemon time to create the pid file
		fi
                if test -f ${CHROOT}/${PIDFILE} ; then
                    einfo "   ${file}"
                else
                    eerror "   error starting: ${file}"
                fi
            fi
Comment 1 Lance Albertson (RETIRED) gentoo-dev 2010-06-21 00:48:22 UTC
Thanks for reporting the bug. I had noticed that problem as well but didn't get a chance to look into it further. While this fix is kind of a workaround I think its the most simple approach to it.

I just committed your fix to portage.