Author Message
AmitChouhan
Joined: Dec 30, 2013
Messages: 33
Offline
Hi,

We have a OD application which has a DBOP to insert some data to a MS-SQL DB. At times what happens is that the operation takes a tad too long to complete , more than 11 secs(which is the IVRS fetch timeout), and an error.badfetch exception is thrown. This is being handled in the code. But for some reason the DBOP thread still seems to be running in the tomcat after the application has exited. In this case we receive exceptions in the catalina.out file as follows:
----------------------------------------------------------------------------------------------------

Fatal Error : caught exception [java.lang.NullPointerException] while trying to report applicaiton exception [javax.servlet.ServletException: EXCEPTION>
java.lang.NullPointerException
]
java.lang.NullPointerException
*** Abandoning thread sessionid [D049D57134E10835BB2A6CF6F152486E:/SelfServiceApp_v2], request invalid, ignore trace above
*** Abandoning thread sessionid [D049D57134E10835BB2A6CF6F152486E:/SelfServiceApp_v2], request invalid, ignore trace above
------------------------------------------------------------------------------------------------------

After sometime the tomcat shuts down with a JVM memory crash dump "Java.lang.OutOfMemoryError: requested 1076688 bytes for Chunk::new. Out of swap space?". What could be causing this?
We have already tuned the Tomcat JVM memory according to the call volume and are investigating as to why the DBOP is taking so long from the DB end.
In the meanwhile is there a way to implement a query timeout for the DBOP operations to ensure that no stray threads are left running?
I did see an earlier thread relating to DD/ Oracle DB that mentions overriding the DBOP java method and handling the result. Is there some other way to do it in OD?
WilsonYu
Joined: Nov 6, 2013
Messages: 3950
Offline
If you google "requested bytes for Chunk::new. Out of swap space", it would tell you what could be the cause and what to adjust according to your situation.
You could try the overriding method to set the query timeout. It really depend what the jdbc driver can do. OD can not interrupt the call. If the delay is consistent, you could lengthen the fetch timeout to accommodate that.
AmitChouhan
Joined: Dec 30, 2013
Messages: 33
Offline
What method should I override for an OD DB operation?. There is no execute() or updateBeforeExecute() method in the java code. Could you provide a sample code for OD?
JuanMorales2
Joined: Dec 16, 2013
Messages: 44
Offline
With SQL Server you can also reduce the timeout (to say, 9 secs) on the JDBC URI, like thisL jdbc:sqlserver://1.2.3.4:1433;DatabaseName=MY_DB;LoginTimeout=9;QueryTimeout=9

That way if the operation takes too long, instead of a fetch timeout you get a normal exception that can be handled on your data nodes.
WilsonYu
Joined: Nov 6, 2013
Messages: 3950
Offline
You need to add the method to the Java class:

protected void updateBeforeExecute(PreparedStatement statement)
throws SQLException {
statement.setQueryTimeout(15);
super.updateBeforeExecute(statement);
}
Go to:   
Mobile view