PostgreSQL memory bug - Mailing list pgsql-bugs

From yoursoft@freemail.hu
Subject PostgreSQL memory bug
Date
Msg-id 41B5620A.1070202@freemail.hu
Whole thread Raw
Responses Re: PostgreSQL memory bug
List pgsql-bugs
Dear Developer Team!

I use the PostgreSQL 7.4.5 on SLES9.0 and PostgreSQL 7.4.3 on SuSE 9.0
(I think this problem exists in 8.0 too).

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.
In 7.4.5 the logfile contains: 'out of memory error', and postmaster.pid
file is deleted.
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):
//-----------------------------------------
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/anything",
"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

pgsql-bugs by date:

Previous
From: "Steve McWilliams"
Date:
Subject: pg_autovacuum fails to run as a windows service (beta4)
Next
From: Jarosław Marciniak
Date:
Subject: problem while installitn PSQL 8.0 (win)