Bug 1034831

Summary: Select count(*) from SQL Server database throws exception
Product: [JBoss] JBoss Data Virtualization 6 Reporter: Lucie Fabrikova <lfabriko>
Component: TeiidAssignee: Van Halbert <vhalbert>
Status: CLOSED NOTABUG QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.0.0CC: atangrin, fnguyen, lfabriko, shawkins, vhalbert
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Some users are finding that the server throws an exception when running a 'select count(*)' query against an SQL Server database.
Story Points: ---
Clone Of: Environment:
Teiid Designer 8.3.0.CR1, JBDS7.1.0.CR1, DV6 ER4, JBTools 4.1.3.Beta5, SQL Server driver sqljdbc4.jar
Last Closed: 2013-12-16 14:04:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
zipped project none

Description Lucie Fabrikova 2013-11-26 15:08:19 UTC
Created attachment 829319 [details]
zipped project

Description of problem:
In teiid designer, executing a query "SELECT COUNT(*) FROM TvGuideStaging.AVAILABLE_PROGRAMS" throws 
OPTIMIZATION COMPLETE:
PROCESSOR PLAN:
AccessNode(1) output=[anon_grp0.agg0 AS expr1] SELECT COUNT(*) FROM TvGuideStaging.AVAILABLE_PROGRAMS AS g_0

============================================================================

15:36:26,865 WARN  [org.teiid.CONNECTOR] (Worker3_QueryProcessorQueue670) Connector worker process failed for atomic-request=7DFueHqZupoC.0.1.251: org.teiid.translator.jdbc.JDBCExecutionException: 0 TEIID11008:TEIID11004 Error executing statement(s): [Prepared Values: [] SQL: SELECT COUNT(*) FROM "searchb"."dbo"."AVAILABLE_PROGRAMS" g_0]
	at org.teiid.translator.jdbc.JDBCQueryExecution.execute(JDBCQueryExecution.java:88)
	at org.teiid.dqp.internal.datamgr.ConnectorWorkItem.execute(ConnectorWorkItem.java:312) [teiid-engine-8.4.1-redhat-5.jar:8.4.1-redhat-5]
	at org.teiid.dqp.internal.process.DataTierTupleSource.getResults(DataTierTupleSource.java:301) [teiid-engine-8.4.1-redhat-5.jar:8.4.1-redhat-5]
	at org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:113) [teiid-engine-8.4.1-redhat-5.jar:8.4.1-redhat-5]
	at org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:110) [teiid-engine-8.4.1-redhat-5.jar:8.4.1-redhat-5]
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [rt.jar:1.6.0_45]
	at java.util.concurrent.FutureTask.run(FutureTask.java:138) [rt.jar:1.6.0_45]
	at org.teiid.dqp.internal.process.FutureWork.run(FutureWork.java:58) [teiid-engine-8.4.1-redhat-5.jar:8.4.1-redhat-5]
	at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:269) [teiid-engine-8.4.1-redhat-5.jar:8.4.1-redhat-5]
	at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:119) [teiid-engine-8.4.1-redhat-5.jar:8.4.1-redhat-5]
	at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:214) [teiid-engine-8.4.1-redhat-5.jar:8.4.1-redhat-5]
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) [rt.jar:1.6.0_45]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) [rt.jar:1.6.0_45]
	at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_45]
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed.
	at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:130)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.checkClosed(SQLServerConnection.java:294)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.prepareStatement(SQLServerConnection.java:1980)
	at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection.doPrepareStatement(BaseWrapperManagedConnection.java:738)
	at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection.prepareStatement(BaseWrapperManagedConnection.java:724)
	at org.jboss.jca.adapters.jdbc.WrappedConnection.prepareStatement(WrappedConnection.java:405)
	at org.teiid.translator.jdbc.JDBCBaseExecution.getPreparedStatement(JDBCBaseExecution.java:184)
	at org.teiid.translator.jdbc.JDBCQueryExecution.execute(JDBCQueryExecution.java:82)
	... 13 more

15:36:26,868 WARN  [org.teiid.PROCESSOR] (Worker4_QueryProcessorQueue671) TEIID30020 Processing exception for request 7DFueHqZupoC.0 'TEIID30504 TvGuideStaging: 0 TEIID11008:TEIID11004 Error executing statement(s): [Prepared Values: [] SQL: SELECT COUNT(*) FROM "searchb"."dbo"."AVAILABLE_PROGRAMS" g_0]'. Originally TeiidProcessingException 'The connection is closed.' SQLServerException.java:130. Enable more detailed logging to see the entire stacktrace.


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 2 Steven Hawkins 2013-11-27 20:28:18 UTC
From just the expection shown the most likely cause is that the pool had a stale connection.  Was the pool configured to handle stale connections with a test query or an isAlive call?

Comment 4 Lucie Fabrikova 2013-12-06 09:51:27 UTC
I am not sure about the answer, I used it via Teiid Designer without configuring  such option.

Comment 5 Lucie Fabrikova 2013-12-06 13:46:54 UTC
The datasource configuration from standalone.xml:
<datasource jndi-name="java:/TvGuideStaging" pool-name="TvGuideStaging" enabled="true">
	<connection-url>jdbc:sqlserver://slntdb02.mw.lab.eng.bos.redhat.com:1433;databaseName=searchb</connection-url>
	<driver>sqljdbc4.jar</driver>
	<security>
		<user-name>searchb</user-name>
		<password>mm</password>
        </security>
</datasource>

From the DV documentation, I assume the property of interest is "stale-connection-checker", which is not set.


However, I could not reproduce the bug again, so I assume it is not a bug.