Bug #491: ERROR: RelationClearRelation: relation using JDBC

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Bug #491: ERROR: RelationClearRelation: relation using JDBC
Date: 2001-10-24 23:14:37
Message-ID: 200110242314.f9ONEbP73908@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Alex Korneyev (kornale(at)charlie(dot)cns(dot)iit(dot)edu) reports a bug with a severity of 1
The lower the number the more severe it is.

Short Description
ERROR: RelationClearRelation: relation using JDBC

Long Description
Hi,

I have done a little research and seems like this should have been fixed, but it is not. my understanding is that postgres keeps a some sort of a cursor open to the data.

Error happens when i do this:
rs = stmt.executeQuery(sqlString);

The error is fixed by restarting jboss, that is why i think the reference is being kept alive. i close all my connections, statements and result sets.

please let me know if this an error or i am doing something wrong. but i believe that this is a bug, since i have seen a lot of postings for this error.

alex korneyev

stack trace is bellow:
[Default] java.sql.SQLException: ERROR: RelationClearRelation: relation 125857 deleted while still in use

[Default] at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:88)

[Default]

[Default] at org.postgresql.Connection.ExecSQL(Connection.java:356)

[Default]

[Default] at org.postgresql.jdbc2.Statement.execute(Statement.java:129)

[Default]

[Default] at org.postgresql.jdbc2.Statement.executeQuery(Statement.java:54)

[Default]

[Default] at org.jboss.pool.jdbc.StatementInPool.executeQuery(StatementInPool.java:141)

[Default]

[Default] at ch07.UserBean.isSystemUser(UserBean.java:219)

[Default]

[Default] at ch07.UserBean.ejbCreate(UserBean.java:248)

[Default]

[Default] at java.lang.reflect.Method.invoke(Native Method)

[Default]

[Default] at org.jboss.ejb.plugins.BMPPersistenceManager.createEntity(BMPPersistenceManager.java:136)

[Default]

[Default] at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:616)

[Default]

[Default] at java.lang.reflect.Method.invoke(Native Method)

[Default]

[Default] at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:843)

[Default]

[Default] at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:231)

[Default]

[Default] at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:154)

[Default]

[Default] at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:108)

[Default]

[Default] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:135)

[Default]

[Default] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:307)

[Default]

[Default] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:86)

[Default]

[Default] at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:103)

[Default]

[Default] at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:106)

[Default]

[Default] at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:420)

[Default]

[Default] at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeHome(JRMPContainerInvoker.java:372)

[Default]

[Default] at java.lang.reflect.Method.invoke(Native Method)

[Default]

[Default] at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:241)

[Default]

[Default] at sun.rmi.transport.Transport$1.run(Transport.java:142)

[Default]

[Default] at java.security.AccessController.doPrivileged(Native Method)

[Default]

[Default] at sun.rmi.transport.Transport.serviceCall(Transport.java:139)

[Default]

[Default] at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:443)

[Default]

[Default] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:643)

[Default]

[Default] at java.lang.Thread.run(Thread.java:484)

[Default]

Sample Code
private boolean isSystemUser( String loginID )
throws Exception{

Statement stmt = null;
Connection conn = null;
ResultSet rs = null;
try {
System.out.println("isSystemUser");
conn = DBUtils.getConnection();

String sqlString =
"select " + User.OID_MAPFIELD
+",upper("
+ User.USR_LOGIN_ID_MAPFIELD
+ ") "
+ " from users where upper("
+ User.USR_LOGIN_ID_MAPFIELD +") = upper('"+loginID+"')";

System.out.println("sqlString = " + sqlString );
stmt = conn.prepareStatement(sqlString);

rs = stmt.executeQuery(sqlString);
if ( rs.next() ) {
System.out.println("found user ... ");
System.out.println("user oid: " + rs.getLong(User.OID_MAPFIELD) );
return true;
} else {
return false;
}

}
catch( Exception e) {
e.printStackTrace();
throw new CreateException( e.getMessage() );
}
finally {
DBUtils.releaseConnection( conn, stmt, rs );
}
}

No file was uploaded with this report

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2001-10-25 03:43:11 Re: Bug #491: ERROR: RelationClearRelation: relation using JDBC
Previous Message Tom Lane 2001-10-24 22:41:38 Re: New default ignored by pre-exising insert rulesets.