Hi,

Some of our customers have reported about getting "The object is already 
closed" error, and that the application hasn't been returning correct 
results since when those errors appeared. Debugging with DEBUG_LEVEL_3 
config param added to connection URL, we found these traces:

02-12 14:11:56 jdbc[3]: 
/**/Statement stat25629 = conn4.createStatement(1004, 1007);
02-12 14:11:56 jdbc[14]: 
/*SQL */COMMIT;
02-12 14:11:56 jdbc[3]: 
/**/stat25628.execute("Select COUNT(*) AS rowcount From VHost");
02-12 14:11:56 lock: 3 shared read lock requesting for VHOST
02-12 14:11:56 lock: 3 shared read lock ok VHOST
02-12 14:11:56 jdbc[3]: 
/*SQL #:1*/Select COUNT(*) AS rowcount From VHost;
02-12 14:11:56 lock: 3 shared read lock unlock VHOST
02-12 14:11:56 jdbc[3]: 
/**/stat25628.getUpdateCount();
02-12 14:11:56 jdbc[3]: 
/**/stat25629.getResultSet();
02-12 14:11:56 lock: 13 shared read lock requesting for VPORTGROUP
02-12 14:11:56 lock: 13 shared read lock ok VPORTGROUP
02-12 14:11:56 jdbc[14]: 
/**/Statement stat25630 = conn15.createStatement(1004, 1007);
02-12 14:11:56 jdbc[14]: 
/**/stat25630.execute("update LocatorForward set 
MACAddress='d8c7c8:cc5e18',SwitchIPAddress='172.17.5.45',LinkCount='0',linkIpAddr='',TimeStmp='2015-02-12
 
14:11:33.241',IfIndex='40000018',Slot='1',Port='1',VlanID='3105',IfSpeed='0',IfAdminStatus='1',PortDuplexMode='-1',userid=NULL,domain='0',disposition='1',unp='',classsource='0',serviceId='3105',isid='0',Chassis='0'
 
where MACAddress='d8c7c8:cc5e18' and SwitchIPAddress='172.17.5.45' and 
VlanID='3105'");
02-12 14:11:56 jdbc[3]: 
/**/stat25629.close();
02-12 14:11:56 jdbc[3]: 
/**/Statement stat25631 = conn4.createStatement(1004, 1007);
02-12 14:11:56 jdbc[3]: 
/**/stat25631.execute("Select COUNT(*) AS rowcount From VDataCenter");
02-12 14:11:56 jdbc[3]: 
/**/PreparedStatement prep14217 = conn4.prepareStatement("select ID, NAME, 
VMID, HOSTID, MACADDRESS, NETWORKNAME, ADDRESSTYPE, VCENTERID, STATUS, 
TIMESTAMP, CREATETIMESTAMP, PORTKEY, PORTGROUPKEY from VNETWORK where 
status='A' and vmid=13451 and vcenterid=1", 1003, 1007);
02-12 14:11:56 jdbc[3]: 
/**/stat25629.execute("update RevDnsInfo set 
IpAddress='172.31.46.71',IpName='',InfoTime='2015-02-12 
14:11:50.858',NeedTime='1970-01-01 10:00:00.000' where 
IpAddress='172.31.46.71'");
02-12 14:11:56 jdbc[3]: exception
org.h2.jdbc.JdbcSQLException: The object is already closed [90007-169]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
at org.h2.message.DbException.get(DbException.java:169)
at org.h2.message.DbException.get(DbException.java:146)
at org.h2.message.DbException.get(DbException.java:135)
at org.h2.jdbc.JdbcStatement.checkClosed(JdbcStatement.java:928)
at org.h2.jdbc.JdbcStatement.checkClosedForWrite(JdbcStatement.java:915)
at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:160)
at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:152)


Please look at stat25629, it was first created, then called to 
getResultSet() without executing any query, and close() before it called to 
execute("update RevDnsInfo set 
IpAddress='172.31.46.71',IpName='',InfoTime='2015-02-12 
14:11:50.858',NeedTime='1970-01-01 10:00:00.000' where 
IpAddress='172.31.46.71'"). Even the executed query is not correct, it 
should be a select query instead.

Our application uses Embedded H2 database, autocommit=true, 
LOCK_TIMEOUT=5000ms and no other configuration. The application allows many 
jdbc connections to be run at once and maintain them by code, however the 
code has been made sure that one connection can only be accessed by one 
thread at once, till it finishes its job and released.

Is there any possible case that the above scenario can happen?

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to