Logged by: Lutischan Ferenc
Email address: yoursoft ( at ) freemail ( dot ) hu
PostgreSQL version: 7.4.3, 7.4.5
Operating system: Linux: SuSE9.0, SLES9
Description: Out of memory
Details:
Dear Developer Team!
I use the PostgreSQL 7.4.5 on SLES9.0 and PostgreSQL 7.4.3 on SuSE 9.0 (I tested this problem on win32 8.0RC1, but that version is OK).
If you make 'create user' and 'alter group' sql command on existing users, and make it many times, the server doesn't release the memory.
After 6-7000 calls the server is crashed with an 'out of memory' error. I think this is not a big bug, but the long time without restaring the server, may be make an 'out of memory' crash.
-In 7.4.5 the logfile contains: 'out of memory error', and postmaster.pid file is deleted. There is the end of log file (some messages in Hungarian):
// -------------------------------
.....
2004-12-03 15:32:08 ERROR: user "m010221852922" already exists
2004-12-03 15:32:20 ERROR: user "m018009780020" already exists
TopMemoryContext: 8192 total in 1 blocks; 7088 free (0 chunks); 1104 used
DynaHash: 8192 total in 1 blocks; 7792 free (0 chunks); 400 used
DynaHashTable: 0 total in 0 blocks; 0 free (0 chunks); 0 used
DynaHashTable: 0 total in 0 blocks; 0 free (0 chunks); 0 used
DynaHashTable: 0 total in 0 blocks; 0 free (0 chunks); 0 used
DynaHashTable: 0 total in 0 blocks; 0 free (0 chunks); 0 used
DynaHashTable: 0 total in 0 blocks; 0 free (0 chunks); 0 used
Postmaster: -1232084992 total in 376 blocks; 918106640 free (12751344 chunks); 2144775664 used
ErrorContext: 8192 total in 1 blocks; 8176 free (4 chunks); 16 used
2004-12-03 15:32:29 FATAL: betelt a memoria <- Comment by Ferenc: 'out of memory' in English
DETAIL: Failed on request of size 1.
// -------------------------------
-In 7.4.3 the logfile doesn't contain: 'out of memory error', and postmaster.pid file exists. After deleting the postmaster.pid, and making a 'pg_ctl start' the psql can't connect to the database, only after a full reboot.
I made a Java program to demonstrate the problem (CreateUsers.java). You need to create an 'admin' group before run this program. I tested it with remotely with lastes JDBC driver (pg74.215.jdbc3.jar):
//-----------------------------------------
import java.sql.*;
public class CreateUsers {
public CreateUsers() {
}
public static void main(String[] args) {
Statement loc_sql = null;
StringBuffer loc_sqlString = null;
Connection loc_db = null;
ResultSet loc_eredmeny = null;
try {
Class.forName("org.postgresql.Driver"); //load the driver
for (int i=0; i<20000; i++) {
loc_db = DriverManager.getConnection("jdbc:postgresql://127.0.0.1/template1", "postgres", "password");
loc_sql = loc_db.createStatement();
try {
loc_sqlString = new StringBuffer("CREATE USER ");
loc_sqlString.append( "anybody" );
loc_sqlString.append( " WITH PASSWORD '" );
loc_sqlString.append( "anything" );
loc_sqlString.append( "' NOCREATEDB NOCREATEUSER" );
loc_sql.executeUpdate( loc_sqlString.toString() );
} catch (Exception e2) {
}
try {
loc_sqlString = new StringBuffer("ALTER GROUP ");
loc_sqlString.append( "admin" );
loc_sqlString.append( " ADD USER ");
loc_sqlString.append( "anybody" );
loc_sql.executeUpdate( loc_sqlString.toString() );
} catch(Exception e){ }
loc_db.close();
System.out.println(String.valueOf(i));
}
} catch (Exception e) {
System.out.println(e.toString());
}
} }
//-----------------------------------------
If you have any further questions please mail to me. Best regards: Ferenc
---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings