Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Feb 2014 19:37:34 +0100
From:      Dimitry Andric <dim@FreeBSD.org>
To:        Pavel Timofeev <timp87@gmail.com>
Cc:        freebsd-stable stable <freebsd-stable@freebsd.org>, ports-list freebsd <freebsd-ports@freebsd.org>
Subject:   Re: Squid aufs crashes under 10.0
Message-ID:  <92705E1C-E06E-411D-B88C-5A1AA096E2BD@FreeBSD.org>
In-Reply-To: <CAAoTqfsH9HVgNqxHvKndANT=xU14D-DTLZagJ_yWBC2UqiYN9Q@mail.gmail.com>
References:  <CAAoTqfv7fdPocAS8aywRiwCtiQhW%2BWR3Xpmk0rx7fLRsdbm88Q@mail.gmail.com> <CAAoTqfsH9HVgNqxHvKndANT=xU14D-DTLZagJ_yWBC2UqiYN9Q@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail=_E87A879D-D177-4169-A07F-9199A7700C54
Content-Type: multipart/mixed;
	boundary="Apple-Mail=_DDD4A3DE-3493-4A20-94EF-80FE31FB5ED1"


--Apple-Mail=_DDD4A3DE-3493-4A20-94EF-80FE31FB5ED1
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

On 07 Feb 2014, at 14:24, Pavel Timofeev <timp87@gmail.com> wrote:
> Sorry, it has to be in freebsd-ports@ too.
>=20
> 2014-02-07 Pavel Timofeev <timp87@gmail.com>:
>> Hi!
>> There is a problem with squid under FreeBSD10.0.
>> Squid crashes immediately if storage type is set to aufs.
>> It goes down during read of config file.
>>=20
>> No problem with diskd. No problem with aufs under FreeBSD9.2.
>>=20
>> Someone thinks that it's related to clang which is default compiler =
on
>> FreeBSD 10.0.

Nope, it is a bug in Squid's configure script.  It recognizes FreeBSD
10.x and later as FreeBSD 1.x, causing it to disable pthreads support.
This leads to the required DiskThreads module being disabled too.  It
then crashes when it tries to access a NULL pointer returned by
DiskIOModule::Find("DiskThreads"), in src/fs/ufs/UFSSwapDir.cc:

Fs::Ufs::UFSSwapDir::UFSSwapDir(char const *aType, const char *anIOType) =
: SwapDir(aType), IO(NULL), map(new FileMap()), suggest(0), swaplog_fd =
(-1), currentIOOptions(new ConfigOptionVector()), =
ioType(xstrdup(anIOType)), cur_size(0), n_disk_objects(0)
{
    /* modulename is only set to disk modules that are built, by =
configure,
     * so the Find call should never return NULL here.
     */
    IO =3D new =
Fs::Ufs::UFSStrategy(DiskIOModule::Find(anIOType)->createStrategy());
}

Very bad coding practice, obviously.  It should call Find() first, and
if that returns NULL, it should abort in some sort of controlled way.

In any case, the cause is the following fragment in the configure
script:

          freebsd)
            if test `echo "$squid_host_os_version" | cut -b1` -lt 7 ; =
then
                { $as_echo "$as_me:${as_lineno-$LINENO}: pthread library =
requires FreeBSD 7 or later" >&5
$as_echo "$as_me: pthread library requires FreeBSD 7 or later" >&6;}
                squid_opt_use_diskthreads=3D"no"
            else

which was edited here:

http://bazaar.launchpad.net/~squid/squid/3-trunk/revision/11124

I have attached a tentative patch for the port.  However, this causes
the configure script logic to run a little differently, and there is
some sort of very strange bug in it, that leads to the SQUID_CFLAGS and
SQUID_CXXFLAGS values being mangled in the default case.

With my patch the DiskThreads detection runs again, but the variables
are not mangled anymore, and this leads to -Werror being enabled again,
causing errors about deprecated kerberos5 functions later on in the
build.

For now, I would not bother with -Werror and Squid, but just add
--disable-strict-error-checking to CONFIGURE_ARGS in the Makefile.

That is, until somebody with autoconf knowledge can fix the badly broken
configure script...


>> I recompiled www/squid33 with DEBUG option. Got coredump.
>> Then I did and got this:
>> gdb /usr/local/sbin/squid /var/squid/squid.core
>> ....
>> Reading symbols from /usr/lib/private/libheimipcc.so.11...done.
>> Loaded symbols for /usr/lib/private/libheimipcc.so.11
>> Reading symbols from /libexec/ld-elf.so.1...done.
>> Loaded symbols for /libexec/ld-elf.so.1
>> Segmentation fault (core dumped)
>>=20
>> Gdb goes down too =3D)
>> Any ideas?

Yes, please don't use gdb in base for anything serious.  Use ports gdb
instead. :-)

-Dimitry

--Apple-Mail=_DDD4A3DE-3493-4A20-94EF-80FE31FB5ED1
Content-Disposition: attachment;
	filename=www__squid33-fix-pthreads-detection-1.diff
Content-Type: application/octet-stream;
	name="www__squid33-fix-pthreads-detection-1.diff"
Content-Transfer-Encoding: 7bit

Index: www/squid33/files/patch-configure
===================================================================
--- www/squid33/files/patch-configure	(revision 341653)
+++ www/squid33/files/patch-configure	(working copy)
@@ -1,5 +1,14 @@
 --- configure.orig	2013-03-12 11:18:22.000000000 +0100
 +++ configure	2013-04-09 11:43:01.000000000 +0200
+@@ -19343,7 +19343,7 @@
+ $as_echo "$as_me: Windows threads support automatically enabled" >&6;}
+             ;;
+           freebsd)
+-            if test `echo "$squid_host_os_version" | cut -b1` -lt 7 ; then
++            if test `echo "$squid_host_os_version" | cut -d. -f1` -lt 7 ; then
+                 { $as_echo "$as_me:${as_lineno-$LINENO}: pthread library requires FreeBSD 7 or later" >&5
+ $as_echo "$as_me: pthread library requires FreeBSD 7 or later" >&6;}
+                 squid_opt_use_diskthreads="no"
 @@ -22798,7 +22798,7 @@
  
  done

--Apple-Mail=_DDD4A3DE-3493-4A20-94EF-80FE31FB5ED1
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=us-ascii



--Apple-Mail=_DDD4A3DE-3493-4A20-94EF-80FE31FB5ED1--

--Apple-Mail=_E87A879D-D177-4169-A07F-9199A7700C54
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail

-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)

iEYEARECAAYFAlL3yvcACgkQsF6jCi4glqPApgCfSA6cbPdPF1BVRxfMW8goxd/O
txAAoOelds0kVWuI/m3EAiukcfOUrLHu
=Voe2
-----END PGP SIGNATURE-----

--Apple-Mail=_E87A879D-D177-4169-A07F-9199A7700C54--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?92705E1C-E06E-411D-B88C-5A1AA096E2BD>