Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Jul 1998 12:56:08 -0400 (EDT)
From:      Bill Paul <wpaul@skynet.ctr.columbia.edu>
To:        kkennawa@physics.adelaide.edu.au (Kris Kennaway)
Cc:        current@FreeBSD.ORG
Subject:   Re: inetd problems
Message-ID:  <199807051656.MAA14927@skynet.ctr.columbia.edu>
In-Reply-To: <Pine.OSF.3.90.980706000351.17086A-100000@mercury> from "Kris Kennaway" at Jul 6, 98 00:09:27 am

next in thread | previous in thread | raw e-mail | index | archive | help
Of all the gin joints in all the towns in all the world, Kris Kennaway 
had to walk into mine and say:

> I'm getting the following on my smtp port when I connect to it:
> 
> [morden|kkenn] 0:05 ~ telnet localhost smtp
> Trying 127.0.0.1...
> Connected to localhost.rebel.net.au.
> Escape character is '^]'.
> inetd in realloc(): warning: junk pointer, too low to make sense.
> 220 morden.net.au ESMTP
> 
> I recall noticing this some time ago as well, but didnt look into it any 
> further - but I'm currently having intermittent problems delivering messages 
> via smtp, and this is possibly related.
> 
> [morden|kkenn] 0:08 ~ ls -l /usr/sbin/inetd
> -r-xr-xr-x  1 bin  bin  24576 Jun 21 22:18 /usr/sbin/inetd*
> 
> (A diff between this and a copy compiled from current sources shows no 
> differences)
> 
> Any ideas?

Hm. You know, I've been watching messages like this go by (people
getting noise from inetd about malloc()/realloc()/free() problems)
and I can't help but wonder why nobody has really sat down and
tried to debug things thoroughly.

I encounter messages like this occasionally with my own code (mostly
NIS+ stuff) and without exception, the cause has always been some
kind of bug on my part (double free(), free()ing static buffers by
mistake, corrupting the heap by wandering past the end of a malloc()ed
buffer, etc...). All the theories I've heard so far point to some
kind of VM problem; nobody as yet has been willing to admit that
the problem is a bug in inetd.

I've found that the best thing for nailing these kinds of bugs is 
Electric Fence and gdb. Recompile inetd with -g, link it with
Electric Fence, and run it, then see if you can get it to explode.
Once it dumps core, gdb will tell you exactly where the real
problem is (alternatively, you can attach to the running instance
of inetd with gdb and catch the crash immediately).

I should point out however that I'm uncertain that the particular
problem you're seeing is actually being caused by inetd. It seems
unusual that inetd would give you such a message for a simple thing
like spawing an smtp process for you, so I'm wondering if maybe
the error message about realloc() isn't coming from the smtp server
instead, and it only _says_ inetd because inetd was the parent
process that launched smtpd. (It shouldn't do that of course, but
anything's possible.)

More details would help here: under what conditions does this
problem occur? Do you see the 'realloc' error all the time, or just
when the system is heavily loaded? Exactly what smtp server is this?
How many users does the server handle mail for? Can you debug this
by recompiling inetd with the Electric Fence library and analyzing
the crash dump? If not, can you at least provide a recipe for
duplicating the bug so that someone else can try debugging it?

-Bill

-- 
=============================================================================
-Bill Paul            (212) 854-6020 | System Manager, Master of Unix-Fu
Work:         wpaul@ctr.columbia.edu | Center for Telecommunications Research
Home:  wpaul@skynet.ctr.columbia.edu | Columbia University, New York City
=============================================================================
 "It is not I who am crazy; it is I who am mad!" - Ren Hoek, "Space Madness"
=============================================================================

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199807051656.MAA14927>