Обсуждение: PostgreSQL memory bug

Поиск
Список
Период
Сортировка

PostgreSQL memory bug

От
"yoursoft@freemail.hu"
Дата:
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

Re: PostgreSQL memory bug

От
Tom Lane
Дата:
"yoursoft@freemail.hu" <yoursoft@freemail.hu> writes:
> I use the PostgreSQL 7.4.5 on SLES9.0 and PostgreSQL 7.4.3 on SuSE 9.0

> 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.

I believe this is the same issue already fixed in 7.4.6.

            regards, tom lane