[Spread-users] Memory leak? FD leak? Other?
dshaw at archivas.com
Thu Aug 19 12:07:26 EDT 2004
I've been seeing odd behavior with spread 3.17.2 recently. Basically,
the memory it uses grows steadily and never goes back down again. To
be sure, Spread does some memory management internally so it may not
wish to give back memory when I expect it to, but the behavior I am
seeing is pretty far out of line.
I've attached a simple program (sabuse) that spawns many threads, and
each stuffs large messages into spread without reading them back.
Obviously this is going to cause spread to grow since it must store
the messages. However, there is no limit on the growing - spread will
happily grow until the system runs out of swap, rendering that machine
useless. Limiting the memory via ulimit does not work since spread
will exit with a "Message_add_scat_element: Failed to allocate a new
PACKET_BODY" if it cannot get enough memory.
Of course, under normal circumstances nobody would do such a thing.
However, when I kill the sabuse program. I would expect spread to
give back some memory and it doesn't. I know spread keeps some memory
around for performance reasons, but at this point it owns most of the
memory and swap on the system. Similarly, I would expect spread to
close all the file descriptors it has open to talk to the sabuse
program and it doesn't (this is visible in /proc).
This behavior is on linux 2.4.25, and glibc 2.3.2.
-------------- next part --------------
#define NUM_THREADS 200
void *worker(void *foo)
printf("Spread error %d on connect\n",err);
printf("Spread error %d on multicast\n",err);
printf("Spread error %d on disconnect\n",err);
/* Never reached */
int main(int argc,char *argv)
printf("Failed to make thread %d: %s\n",i,strerror(err));
More information about the Spread-users