From owner-freebsd-amd64@FreeBSD.ORG Thu Oct 28 10:53:47 2004 Return-Path: Delivered-To: freebsd-amd64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 00AF316A4CE for ; Thu, 28 Oct 2004 10:53:47 +0000 (GMT) Received: from gandalf.online.bg (gandalf.online.bg [217.75.128.9]) by mx1.FreeBSD.org (Postfix) with SMTP id 43A4943D2F for ; Thu, 28 Oct 2004 10:53:45 +0000 (GMT) (envelope-from roam@ringlet.net) Received: (qmail 7125 invoked from network); 28 Oct 2004 10:53:40 -0000 Received: from unknown (HELO straylight.ringlet.net) (217.75.134.254) by gandalf.online.bg with SMTP; 28 Oct 2004 10:53:40 -0000 Received: (qmail 31333 invoked by uid 1000); 26 Oct 2004 13:30:02 -0000 Date: Tue, 26 Oct 2004 16:30:02 +0300 From: Peter Pentchev To: Willem Jan Withagen Message-ID: <20041026133002.GG1003@straylight.m.ringlet.net> References: <20041026115041.GE2841@sivokote.iziade.m$> <417E474A.1000401@withagen.nl> <20041026125709.GF1003@straylight.m.ringlet.net> <417E4D6C.4040508@withagen.nl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Q6STzHxy03qt/hK9" Content-Disposition: inline In-Reply-To: <417E4D6C.4040508@withagen.nl> User-Agent: Mutt/1.5.6i cc: Georgi Guninski cc: freebsd-amd64@freebsd.org Subject: Re: two 4GB mallocs => SEGV X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2004 10:53:47 -0000 --Q6STzHxy03qt/hK9 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Oct 26, 2004 at 03:13:16PM +0200, Willem Jan Withagen wrote: > Peter Pentchev wrote: >=20 > >On Tue, Oct 26, 2004 at 02:47:06PM +0200, Willem Jan Withagen wrote: > > > >>Georgi Guninski wrote: > >> > >> > >>>on a freebsd amd64 box with more than 8GB swap i experience the=20 > >>>following: > > > >[snip] > > > >>>amdkotef64# cat test.c > > > >[snip 2 * 4GB malloc] > > > >>>amdkotef64# gcc test.c > >>>amdkotef64# ./a.out=20 > >>>100000000 > >>>503000 > >> > >>>/: write failed, filesystem is full > >>>Segmentation fault > >> > >>These 2 lines stem from the fact that the program is being dumped and= =20 > >>there is not enough space to dump the full size core of that program. > >> > >>what does swapinfo tell you during the the run of the program??? > >> > >>I ran malloc tests in 4Gb with 5Gb of swap, which it nicely completely= =20 > >>filled, and then in faulted, because there was no more space. > >>This behaviour can be set, I think. Check man 5 malloc.conf, and check= =20 > >>/etc/malloc.conf to see if you've got the X-flag on. > > > > > >But shouldn't malloc() write out an 'out of memory' message before the > >core dump then? There's no such message in Georgi's output. >=20 > That depends on the flags set with malloc.conf. The X-flag tells you how= =20 > errors are handled. But you are right, it is strange: > malloc should either return 0, or give a warning. I looked at the source before posting that - src/lib/libc/stdlib/malloc.c, and the handling of malloc_xmalloc invokes wrterror(), which writes to stderr before aborting. > I think that std-malloc settings were AX for anything before -STABLE. Actually they were 'AJ', not 'AX', and they were turned off on Sep 7 for RELENG_5. Georgi's uname shows 5.3-BETA6, which was cut about Sep 23, so neither 'J' nor 'X' ought to be set by default. Still, Georgi, can you check if you have a MALLOC_OPTIONS variable or a /etc/malloc.conf symlink? > >It's true that when he asked me on Saturday about this, I completely > >forgot about malloc's X flag, but I don't think he's using it, and even > >if he were, there ought to be a message there. >=20 > That's why I send him to the man-page. He could even force the settings i= n=20 > the testprogram. And check the link!!! it is probably set to something, o= r=20 > something is assumed. So better be safe and force it one-selves. >=20 > Could be that the message does not arrive because the out-of-mem trap=20 > killed it first.... ??? > Perhaps also check /var/log/messages. I remember seeing things there as= =20 > well. Aye, that's a good idea. > >>I have malloc.conf-> aj, and the program terminates in 3 seconds becaus= e=20 > >>it does not zero the memory. > >> > >>So pick and choose the behaviour you want. > > > > > >Sure, the question is if this is the result of 'X' or something else :) >=20 > Well given the fact that there are not yet that many big boxes, let alone= =20 > people really wanting to allocate a 4Gb blob, I'm not going to bet the=20 > usual case of beer on it. :~) I won't either - seeing as, physical distance considered, Georgi has a much better chance to find me and hold me up to it :) G'luck, Peter --=20 Peter Pentchev roam@ringlet.net roam@cnsys.bg roam@FreeBSD.org PGP key: http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553 If the meanings of 'true' and 'false' were switched, then this sentence wou= ldn't be false. --Q6STzHxy03qt/hK9 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (FreeBSD) iD8DBQFBflFa7Ri2jRYZRVMRAlDEAJ92iMMqku4hoeU/dJ+IchkceaODVQCgpiWF D264VA0LU0ATRmKaRuxY+aE= =dUIh -----END PGP SIGNATURE----- --Q6STzHxy03qt/hK9--