BUG #1605: Is this a bug of PostgreSQL?Or, is the parameter of Windows set?

From: "Takehsi Sawai" <sawait(at)nttdata(dot)co(dot)jp>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #1605: Is this a bug of PostgreSQL?Or, is the parameter of Windows set?
Date: 2005-04-18 05:16:36
Message-ID: 20050418051636.192A0F0C85@svr2.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 1605
Logged by: Takehsi Sawai
Email address: sawait(at)nttdata(dot)co(dot)jp
PostgreSQL version: 8.0.1/8.0.2
Operating system: Windows 2003 Server
Description: Is this a bug of PostgreSQL?Or, is the parameter of
Windows set?
Details:

Hi.

I'm from Japan. Sorry for my English.

The following server logs are output when the program that gets a large
amount of Connection with PostgreSQL8.0.1/8.0.2 is operated, and PostgreSQL

stops. Concretely, all the postgres processes and the postmaster processes
stop.

It reproduces without fail without fail, and, every time, it fails because
of
the acquisition of the connection of piece 490.

---- PostgreSQL Server Log ----
(DEBUG5)
>2005-04-13 08:14:43 FATAL: XX000: could not create sigchld waiter thread:
error code 8
>2005-04-13 08:14:43 LOCATION: internal_forkexec, postmaster.c:3143
-------------------------------

The environment of the machine and the setting of PostgreSQL are as follows.

---- spec ----
CPU:Xeon 2.4GHz x 1
Mem:2GB
HD:73GB2(RAID-1)
OS:Windows Server 2003(Standard/Enterprise)
-------------------------------

---- postgresql.conf ----
listen_addresses='*'
max_connections=1000
shared_buffer=2000
-------------------------------

From log Function CreateThread, and to failure, and error code 8=
ERROR_NOT_ENOUGH_MEMORY native of win32

However, the memory that can be used seems to have room enough from
Windows task manager -> performance.
Is this a bug of PostgreSQL?Or, is the parameter of Windows set?

---- postmaster.c ----
(line 3138 - 3144)
> waiterThread = CreateThread(NULL, 64 * 1024, win32_sigchld_waiter,
> (LPVOID) childHandleCopy, 0, NULL);
> if (!waiterThread)
> ereport(FATAL,
> (errmsg_internal("could not create sigchld waiter thread: error code
%d",
> (int) GetLastError())));
-------------------------------

---- Link MSDN ----
CreateThread
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/bas
e/createthread.asp
ERROR CODE
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/debug/base/
system_error_codes__0-499_.asp
-------------------------------

Program for test as follows

---- Simple Java program ----
(JDBC Driver : postgresql-8.0-310.jdbc3.jar)
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Iterator;

public class ConnectionCheck {

public static void main(String[] args) {
String driver = "org.postgresql.Driver";
String url = "jdbc:postgresql://10.8.255.131:5432/eval-pg";
String user = "eval-pg";
String password = "kayabacho";

Statement stmt = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
Connection con = null;
int status = 1;
int count = 0;

int maxConnection = 1000;
int numConnection = 0;
int numCloseConnection = 0;
ArrayList conList = new ArrayList();
Iterator it = null;

//CLASS LOADER
try {
Class.forName(driver);
} catch (ClassNotFoundException e) {
// TODO: handle exception
e.printStackTrace();
status = 0;
}

//TEST
try {
for(int i = 0; i < maxConnection; i++){
con = DriverManager.getConnection(url,user,password);

if(con != null){
numConnection++;
conList.add(con);
System.out.println("# of Connection is " + numConnection + " : ok");
}
else{
throw new SQLException();
}
}

} catch (SQLException e) {
// TODO: handle exception
e.printStackTrace();
status = 0;
}

//close
try {
numCloseConnection = numConnection;
it = conList.iterator();
while(it.hasNext()){
con = (Connection)it.next();
if(con != null || !con.isClosed()){
con.close();
numCloseConnection--;
System.out.println("# of Result Connection is " + numCloseConnection +
" : ok");
}
}
} catch (SQLException e) {
// TODO: handle exception
e.printStackTrace();
status = 0;
}

System.out.println("# of Get Connection is " + numConnection + " : ");
System.out.println("--END");

return;
}
}
-------------------------------

---- Exception from Simple Java program(at 490 connection) ----
org.postgresql.util.PSQLException: Connection refused. Check that the
hostname and port are correct and that the postmaster is accepting TCP/IP
connections.
at
org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFa
ctoryImpl.java:122)
at
org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:
65)
at
org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.
java:117)
at
org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.
java:30)
at org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24)
at org.postgresql.Driver.connect(Driver.java:235)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at ConnectionCheck.main(ConnectionCheck.java:58)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at org.postgresql.core.PGStream.<init>(PGStream.java:58)
at
org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFa
ctoryImpl.java:77)
... 8 more
-------------------------------

Browse pgsql-bugs by date

  From Date Subject
Next Message Márcio A. Sepp 2005-04-18 16:12:37 Problem with pgdump_all
Previous Message Guilherme Paiva 2005-04-17 21:04:32 Lib use.