Bug 195921 - ftp/proftpd crashes with error message "Alarm clock"
Summary: ftp/proftpd crashes with error message "Alarm clock"
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Martin Matuska
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-12 12:35 UTC by Stefan.Sabolowitsch
Modified: 2015-02-05 15:40 UTC (History)
8 users (show)

See Also:
bugzilla: maintainer-feedback? (mm)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan.Sabolowitsch 2014-12-12 12:35:13 UTC
Overview:
On FreeBSD 10.1-RELEASE-i386 crash proftpd after a few seconds.

Steps to Reproduce:
build with own poudriere server (latest devel version) or local via "make, make install" in the ports tree.

Actual Results:
proftpd chrash after a few seconds with error message "Alarm clock"

./proftpd -n -d 10
2014-12-11 09:30:35,893 XX proftpd[748] 192.168.100.159: ProFTPD 1.3.5 (stable) (built Tue Dec 9 2014 00:34:04 UTC) standalone mode STARTUP
2014-12-11 09:30:35,894 XX proftpd[748] 192.168.100.159: ROOT PRIVS at pidfile.c:47
2014-12-11 09:30:35,894 XX proftpd[748] 192.168.100.159: RELINQUISH PRIVS at pidfile.c:49
Alarm clock

Additional Information:

* Even when i compile proftpd "without" following options.

- PCRE support
- CPPFLAGS+=-DHAVE_OPENSSL -I${OPENSSLINC}
- LIBS+=-lssl -lcrypto -L${OPENSSLLIB}
- mod_sql_password
- mod_sftp_*
- mod_tls_*

proftpd will works again

Reference thread:
http://forums.freebsd.org/threads/proftpd-crashes-with-alarm-clock.49445/
https://forums.proftpd.org/smf/index.php/topic,11657.0.html

The first time seen on 10/12/2014, proftpd was recompiled on new / missing dependencies.
Comment 1 Bugzilla Automation freebsd_committer freebsd_triage 2014-12-12 12:35:13 UTC
Auto-assigned to maintainer mm@FreeBSD.org
Comment 2 Daniel Austin 2014-12-13 21:15:50 UTC
This has happened previously, see:

http://bugs.proftpd.org/show_bug.cgi?id=3815
and
http://bugs.proftpd.org/show_bug.cgi?id=3795

Looks like the same issue.
Comment 3 Jeremy Phillippe 2014-12-16 21:53:31 UTC
It appears the proftpd configure script runs openssl version -f and checks to see if the output contains -pthread

However, when I run that command I just get

compiler: cc 

Which seems to be lacking in any of the CFLAGS it was built with, including -pthread

That in turn causes the proftpd configure to fail.

I don't know if this is the preferred way to check for pthread?

If so I guess it would be more of an OpenSSL issue?
Comment 4 Daniel Austin 2014-12-16 21:55:48 UTC
indeed, a workaround to make it compile & run is to add:

LDFLAGS+= -pthread

to the port Makefile.

I'm not sure who needs to look at it though.
Comment 5 Walter Hop 2014-12-23 17:42:59 UTC
I've noticed the same behavior on FreeBSD 9.3 and FreeBSD 10.1 in a recent port update.

The presence of SIGALRM is normal; proftpd uses an alarm clock to periodically check for the presence of /etc/shutmsg. However, right now, proftpd just exits after that.

Can confirm that adding the following to Makefile is a workaround:
  LDFLAGS+= -pthread
Comment 6 Chris Collins 2014-12-29 08:40:53 UTC
Well I have the same issue, but will add I use the ports version of openssl, if I run this command it shows -pthread correctly.

/usr/local/bin/openssl version -f

So the first obvious problem is the openssl check is using the wrong binary when openssl port is enabled.

I assume fiddling with the path env and prioritising so /usr/local/bin is used before /bin and /usr/bin then the compile would work properly.  But this isn't recommended practice.
Comment 7 marek.bedy 2014-12-29 20:42:10 UTC
Workaround with "LDFLAGS+= -pthread" in Makefile works.
Comment 8 Chris Collins 2014-12-30 12:45:31 UTC
Sorry I forgot to confirm it works for me, it does.

But we need it patched so no workarounds needed.
Comment 9 Michał Margula 2015-01-16 12:44:09 UTC
Hello,

This also affacets me:

FreeBSD boromir.uznam.net.pl 10.1-RELEASE FreeBSD 10.1-RELEASE #0 r274401: Tue Nov 11 21:02:49 UTC 2014     root@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64

root@boromir:/usr/ports/ftp/proftpd # pkg info proftpd
proftpd-1.3.5_4
Name           : proftpd
Version        : 1.3.5_4
Installed on   : Fri Jan 16 13:38:53 CET 2015
Origin         : ftp/proftpd
Architecture   : freebsd:10:x86:64
Prefix         : /usr/local
Categories     : ftp
Licenses       : GPLv2
Maintainer     : mm@FreeBSD.org
WWW            : http://www.proftpd.org/
Comment        : Highly configurable FTP daemon
Options        :
	DOCS           : on
	HTMLDOCS       : off
	IPV6           : on
	MEMCACHE       : off
	NLS            : on
	PCRE           : off
Shared Libs required:
	libintl.so.8
Annotations    :
Flat size      : 6.40MiB

This works fine,but if I enable PCRE (same as in binary PKG) it crashes after first connection.
Comment 10 commit-hook freebsd_committer freebsd_triage 2015-02-01 22:26:08 UTC
A commit references this bug:

Author: mm
Date: Sun Feb  1 22:25:51 UTC 2015
New revision: 378282
URL: https://svnweb.freebsd.org/changeset/ports/378282

Log:
  Fix mirror sites [1]
  Compile with -pthread if using base OpenSSL [2]
  Fix rc script [3]

  PR:	191011 [1], 195921 [2], 196635 [3]

Changes:
  head/ftp/proftpd/Makefile
  head/ftp/proftpd/files/proftpd.in
Comment 11 Chris Collins 2015-02-02 06:49:46 UTC
This will remain broken when the openssl port is installed, I am using the openssl port and it was broken.

you didnt commit a change that when the openssl port is in use to make the port use the port binary, so your change will fix it when port is not installed but remain broken when not installed.
Comment 12 Chris Collins 2015-02-02 06:52:47 UTC
I meant remain broken when openssl port is installed.
Comment 13 commit-hook freebsd_committer freebsd_triage 2015-02-02 10:32:30 UTC
A commit references this bug:

Author: mm
Date: Mon Feb  2 10:32:27 UTC 2015
New revision: 378300
URL: https://svnweb.freebsd.org/changeset/ports/378300

Log:
  Change -pthread to -lpthread

  PR:	195921
  Reported by:	John Marino

Changes:
  head/ftp/proftpd/Makefile
Comment 14 Stefan.Sabolowitsch 2015-02-02 13:05:06 UTC
This patch does not work with me, proftpd crash after a few seconds.
Without the "if" option (OPENSSL_PORT), everything is OK again.

does not work:
CPPFLAGS+= -DHAVE_OPENSSL -I${OPENSSLINC}
LIBS+=     -lssl -lcrypto -L${OPENSSLLIB}
 . if !defined(WITH_OPENSSL_PORT)
LDFLAGS+= -pthread
 . endif
.endif 

works:
CPPFLAGS+= -DHAVE_OPENSSL -I${OPENSSLINC}
LIBS+=     -lssl -lcrypto -L${OPENSSLLIB}
# . if !defined(WITH_OPENSSL_PORT)
LDFLAGS+=  -pthread
# . endif
.endif
Comment 15 Stefan.Sabolowitsch 2015-02-05 15:40:49 UTC
I can confirm proftpd-1.3.5_6 works with me.
(In reply to commit-hook from comment #13)