Bug in pgjdbc2 ? org.postgresql.PG_Stream.flush(PG_Stream.java:355)

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

Bug in pgjdbc2 ? org.postgresql.PG_Stream.flush(PG_Stream.java:355)

От:
Sorin Constantinescu <sorin@work.ro>
Дата:
Hello,
I test a jsp script with ab -c 50 -n 10000 ( 50 simultan connection) an 
sometimes I receive an exception: 
	An I/O error has occured while flushing the output - Exception: 
	java.net.SocketException: Socket closed Stack Trace: 		
	java.net.SocketException: Socket closed at 		
	java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:99) at 
	java.net.SocketOutputStream.write(SocketOutputStream.java:136) at 
	java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:69) at 	
	java.io.BufferedOutputStream.flush(BufferedOutputStream.java:127) at 
	org.postgresql.PG_Stream.flush(PG_Stream.java:355) at 
	org.postgresql.core.QueryExecutor.sendQuery(QueryExecutor.java:135) at 
	org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:64) at 
	org.postgresql.Connection.ExecSQL(Connection.java:398) at 
	org.postgresql.jdbc2.Statement.execute(Statement.java:130) at 
	org.postgresql.jdbc2.Statement.executeQuery(Statement.java:54) at 
org.postgresql.jdbc2.PreparedStatement.executeQuery(PreparedStatement.java:99) 
at _test__jsp._jspService(_test__jsp.java:102) at 

	This is test.jsp: 
 try
 {

          Class.forName("org.postgresql.Driver"); //load the driver
 }
  catch (ClassNotFoundException e)
    {
                 eroare="Eroare 1"+e;
                  out.println(eroare);
         	return;
     }

     try
    {
    		           		  

		dbconn=DriverManager.getConnection("jdbc:postgresql://"+DB_HOST+"/"+DB_NAME,
		DB_USER,DB_PASS); 
      		
	       dbmd = dbconn.getMetaData(); 
    		sql= new java.sql.PreparedStatement[10];

    }
     catch (SQLException e)
     {
         eroare="Eroare 2"+e;
         out.println(eroare);
     	return ;
     }
    java.sql.ResultSet rez;
     for (int j=0;j<10;j++)
    {


     	try
    	{
                sql[0] = dbconn.prepareStatement("select * from cat");
                rez=sql[0].executeQuery();
    	}
    	catch (Exception e)
    	{
      	  	eroare="Eroare 3"+e;
       	 	 out.println(eroare);
        	 inchide();
        	return;
    	}

    	try{
            while (rez.next())
            {
      	      out.println(", "+rez.getString("id"));
            }
        rez.close();
        sql[0].close();

  	  }
   	 catch(Exception e)
    	{
 	        inchide();
	      out.println("Eroare next"+e);
    	}
    } //end for

    try
    {
        dbconn.close();
    }
     catch(Exception e)
    {
        out.println("Eroare inc"+e);
    }

    out.println("OK");


   Please, help me

  Sorin


FAQ