Postmaster uses Large Amounts of Swap

Started by Robert L Mathewsabout 25 years ago2 messagesgeneral
Jump to latest
#1Robert L Mathews
lists@tigertech.com

Today I noticed that the swap used on my system was > 120M, and it seems
to be coming from the postmaster:

USER %CPU %MEM VSZ RSS STAT START TIME COMMAND
postgres 0.0 0.0 1668 0 SW 2000 0:00 [pg_ctl]
postgres 0.1 1.1 135840 1528 S 2000 134:56 /usr/bin/postmaster -i

That's not normal, is it?

It's been running for 73 days, with fairly light load: there's only one
small database with five tables, all under 2,000 rows, and it gets on
average about one select query every ten seconds and one update query a
minute. I vacuum it about once a week.

The database itself appears to work just fine.

I don't know how long it's been like that; I would think I would have
noticed before this if it had been like that for a while, but I can't
promise that's the case. I've been watching it for two hours and the
amount of memory used has not changed.

I could just restart it and see if it happens again, but I'm wondering if
(assuming this is an aberration) there is something I should check to
find out more details before killing it.

I'm using version 7.0.2 installed from i386 RPMs on Red Hat Linux 6.2.
The machine has 128M of RAM (of which only 55M is in use by other
processes) and 256M of swap.

--
Robert L Mathews, Tiger Technologies

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Robert L Mathews (#1)
Re: Postmaster uses Large Amounts of Swap

Tiger Technologies <lists@tigertech.com> writes:

Today I noticed that the swap used on my system was > 120M, and it seems
to be coming from the postmaster:
USER %CPU %MEM VSZ RSS STAT START TIME COMMAND
postgres 0.0 0.0 1668 0 SW 2000 0:00 [pg_ctl]
postgres 0.1 1.1 135840 1528 S 2000 134:56 /usr/bin/postmaster -i

That's not normal, is it?
It's been running for 73 days, with fairly light load:

Do you use password authentication?

We just recently noticed that the postmaster leaks a few dozen bytes of
memory when processing a password auth request. Attached is a patch
against 7.0.*.

regards, tom lane

*** src/backend/libpq/crypt.c.orig	Sat Jul 17 16:17:01 1999
--- src/backend/libpq/crypt.c	Wed Feb  7 18:40:01 2001
***************
*** 59,64 ****
--- 59,65 ----
  	bufsize = strlen(pwdfilename) + strlen(CRYPT_PWD_RELOAD_SUFX) + 1;
  	rpfnam = (char *) palloc(bufsize);
  	snprintf(rpfnam, bufsize, "%s%s", pwdfilename, CRYPT_PWD_RELOAD_SUFX);
+ 	pfree(pwdfilename);
  	return rpfnam;
  }
***************
*** 79,84 ****
--- 80,87 ----
  	pwdfile = AllocateFile(filename, "rb");
  #endif
+ 	pfree(filename);
+ 
  	return pwdfile;
  }
***************
*** 131,136 ****
--- 134,140 ----

filename = crypt_getpwdreloadfilename();
result = unlink(filename);
+ pfree(filename);

/*
* We want to delete the flag file before reading the contents of the