proftpd service stopped by it's own

Bug #1325338 reported by lepidas blades rompolos on 2014-06-01
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
proftpd-dfsg (Ubuntu)
Undecided
Unassigned

Bug Description

A week ago installed ubuntu 14.04 server and proftpd Version 1.3.5 as standalone to let users uploading files to server. Everything was going fine until today.
From today 01/06/2013 06:30am users could not upload files to server anymore.
I logged in the the server to check it out and I got this from proftpd service status

    service proftpd status
    ProFTPD is started in standalone mode, currently not running.

affects: software-center (Ubuntu) → proftpd (Ubuntu)
description: updated

09/06/2014 06:30
Proftpd stopped again unexpectedly

description: updated
Horst Platz (hp-localhorst) wrote :

mybe it looks like a problem with logrotating

/var/log/proftpd/proftpd.log
[...]
2014-09-07 06:25:07,634 ******* proftpd[1664] ***.***.***.***: ProFTPD 1.3.5rc3 standalone mode SHUTDOWN

-> no "STARTUP" entry

cat /etc/crontab
[...]
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
[...]

cat /etc/logrotate.d/proftpd-basic

[...]
                # reload could be not sufficient for all logs, a restart is safer
                invoke-rc.d proftpd restart 2>/dev/null >/dev/null || true
[...]

and if i try to controle this on the console by hand

# invoke-rc.d proftpd restart
 * Stopping ftp server proftpd [ OK ]
 * Starting ftp server proftpd [ OK ]

but

# ps fax | grep proftpd
26186 pts/0 S+ 0:00 \_ grep --color=auto proftpd

and in the log only "SHUTDOWN"

and if i try it with "/etc/init.d/proftpd restart" it work properly. so i change the logrotate.d/proftpd-basic script and i see what happent tomorrow...

regrads

Launchpad Janitor (janitor) wrote :

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

Changed in proftpd (Ubuntu):
status: New → Confirmed
Colin Dearborn (stolen) wrote :

Looks like it's the /etc/init.d/proftpd init script.
when the process is not running, "sudo /etc/init.d/proftpd restart" works. If the process is already running, this command only shuts down proftpd.

stolen@derf:/etc$ ps aux | grep proftp | grep -v grep
stolen@derf:/etc$ sudo /etc/init.d/proftpd restart
 * Stopping ftp server proftpd [ OK ]
 * Starting ftp server proftpd [ OK ]
stolen@derf:/etc$ ps aux | grep proftp | grep -v grep
proftpd 20327 0.0 0.0 115956 2416 ? Ss 00:01 0:00 proftpd: (accepting connections)
stolen@derf:/etc$ sudo /etc/init.d/proftpd restart
 * Stopping ftp server proftpd [ OK ]
 * Starting ftp server proftpd [ OK ]
stolen@derf:/etc$ ps aux | grep proftp | grep -v grep
stolen@derf:/etc$

It appears it's trying to start the process too quickly.
I altered the following code in the init script from:
    force-reload|restart)
        if [ "x$RUN" = "xyes" ] ; then
            signal stop 1
            start

To:
    force-reload|restart)
        if [ "x$RUN" = "xyes" ] ; then
            signal stop 1
            sleep 1
            start

to add a 1 second pause, and now all is well:

stolen@derf:/etc$ ps aux | grep proftp | grep -v grep
proftpd 20512 0.0 0.0 115964 2420 ? Ss 00:02 0:00 proftpd: (accepting connections)
stolen@derf:/etc$ sudo /etc/init.d/proftpd restart
 * Stopping ftp server proftpd [ OK ]
 * Starting ftp server proftpd [ OK ]
stolen@derf:/etc$ ps aux | grep proftp | grep -v grep
proftpd 20635 0.0 0.0 115956 2424 ? Ss 00:04 0:00 proftpd: (accepting connections)
stolen@derf:/etc$

Jan Baranowski (jan-baranowski) wrote :

Can confirm the bug. I believe it is due to slow proftpd shutdown and start-stop-daemon not waiting for proftpd process to shut down entirely (to remove its PID file to be exact).

In my case I'm using proftpd together with MySQL and i suspect this is the cause for slow shutdown.

While solution proposed by Colin Dearborn seems to work fine (unless of course shutdown takes more than 1 sec), I'd like to propose making start-stop-daemon wait for proftpd to exit, that is:

Line 109 of /etc/init.d/proftpd:

From:
    start-stop-daemon --stop --signal $SIGNAL --quiet --pidfile "$PIDFILE"

To:
    start-stop-daemon --stop --signal $SIGNAL --quiet --pidfile "$PIDFILE" --retry=10/TERM/10

(stopping proftpd using $SIGNAL which is SIGTERM at the time, waiting 10 secs for it to terminate, retrying SIGTERM and waiting again)

Note that we cannot use simple --retry=10 because this will be interpreted by start-stop-daemon as --retry=TERM/10/KILL/10 and we really dont want even the slightest chance to KILL proftpd at this moment in script.

BTW:
proftpd -v:
ProFTPD Version 1.3.5rc3

lsb_release -a:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04 LTS
Release: 14.04
Codename: trusty

Jan Baranowski (jan-baranowski) wrote :

My bad... --retry=10/TERM/10 makes second check after 10 seconds so I'd recommend to make it something like --retry=1/TERM/1 instead. If proftpd will not shutdown within these 2 seconds, script will try to KILL it and remove PID file. And this will make subsequent start action work as expected.

Amr Ibrahim (amribrahim1987) wrote :

In the future, please use 'ubuntu-bug package-name' to report Ubuntu bugs.
https://help.ubuntu.com/community/ReportingBugs

You have reported a bug in a non-existent package in Ubuntu archives since 2007. No developer will see this bug report because simply the package does not exist any more.

affects: proftpd (Ubuntu) → proftpd-dfsg (Ubuntu)
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers