https://bz.apache.org/bugzilla/show_bug.cgi?id=60645
Bug ID: 60645
Summary: StatementFinalizer is not thread-safe
Product: Tomcat Modules
Version: unspecified
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: jdbc-pool
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
The interceptor
org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer
is not thread-safe.
Some JDBC drivers (e.g. MSSQL) allow to use a single JDBC connection in
multiple threads (a statement cannot be shared across threads).
In our application we use multiple different threads which operate on the same
JDBC connection. If a statement is created then the StatementFinalizer stores
it in a java.util.LinkedList (which is not thread-safe and may damage the data
structure).
This might lead to a
java.lang.NullPointerException
at java.util.LinkedList.unlink(LinkedList.java:211)
at java.util.LinkedList.remove(LinkedList.java:526)
at
org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer.closeInvoked(StatementFinalizer.java:59)
at
org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor.invoke(AbstractCreateStatementInterceptor.java:59)
at
org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:108)
at
org.apache.tomcat.jdbc.pool.interceptor.ConnectionState.invoke(ConnectionState.java:152)
at
org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:108)
at
org.apache.tomcat.jdbc.pool.TrapException.invoke(TrapException.java:40)
Our workaround was to create our own thread-safe statement finalizer.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]