c# - Spring.Data.CannotGetAdoConnectionException : Could not get ADO.NET connection -
we have bunch of unit tests running on build server using command line:
mkdir "%workspace%\results" del /q "%workspace%\results*.*"
ncover run --project="%job_name%" --buildid="%job_name%
%build_number% v%the_version%" -- %nunit_exe% output\xyzlibtests\product.xyzlib.tests.dll /exclude:performance
/noshadow /xml=results\xyzlib-testresults.xml
the tests dll c# class library, .net v4.5, , nunit nunit 2.6.4. use spring.net, , context.xml file tests dll is:
<objects xmlns="http://www.springframework.net" xmlns:db="http://www.springframework.net/database" xmlns:tx="http://www.springframework.net/tx"> <import resource="assembly://product.core.sqlserver/product.core.config/context.xml"/> <import resource="assembly://product.importlib/product.import.config/context.xml"/> <db:provider id="dbprovider" provider="sqlserver-2.0" connectionstring="data source=(localdb)\v11.0;attachdbfilename=|datadirectory|\dbdatafile.mdf;integrated security=true"/> <object id="transactionmanager" type="spring.data.core.adoplatformtransactionmanager, spring.data"> <property name="dbprovider" ref="dbprovider"/> </object> <object name="logger" type="spring.objects.factory.config.logfactoryobject, spring.core"> <property name="logname" value="unittestlogger"/> </object> <object id="adotemplate" type="spring.data.core.adotemplate, spring.data"> <property name="commandtimeout" value="240"/> <property name="dbprovider" ref="dbprovider"/> <property name="datareaderwrappertype" value="spring.data.support.nullmappingdatareader, spring.data"/> </object> </objects>
the test classes this:
public class componentdaotest { [testfixturesetup] public void fixturesetup() { this.componentdao = context.getobject<componentdao>(); } [setup] public void setup() { this.componentdao.truncate(); <--cleans localdb attached } //various tests insert , select localdb attached [teardown] public void complete() { this.componentdao.truncate();<--cleans localdb attached } }
the componentdao being tested, , defined in different assembly:
<object id="componentdao" type="product.core.sqlserver.componentdao, product.core.sqlserver"> <property name="adotemplate" ref="adotemplate"/> </object>
its class definition is:
public class componentdao : adodaosupport, icomponentdao
icomponentdao product-specific interface not implement known interfaces such idisposable.
the problem is, these unit tests ran while, see once in while following exception of them (in case findalltest):
teardown error : product.corelib.tests.data.componentdaotest.findalltest 16:16:20 setup : spring.data.cannotgetadoconnectionexception : not ado.net connection. 16:16:20 ----> system.data.sqlclient.sqlexception : connection timeout expired. timeout period elapsed while attempting consume pre-login handshake acknowledgement. because pre-login handshake failed or server unable respond in time. duration spent while attempting connect server - [pre-login] initialization=15370; handshake=55; 16:16:20 ----> system.componentmodel.win32exception : wait operation timed out 16:16:20 teardown : spring.data.cannotgetadoconnectionexception : not ado.net connection. 16:16:20 ----> system.data.sqlclient.sqlexception : connection timeout expired. timeout period elapsed while attempting consume pre-login handshake acknowledgement. because pre-login handshake failed or server unable respond in time. duration spent while attempting connect server - [pre-login] initialization=15370; handshake=55; 16:16:20 ----> system.componentmodel.win32exception : wait operation timed out 16:16:20 @ spring.data.support.connectionutils.getconnectiontxpair(idbprovider provider) 16:16:20 @ spring.data.core.adoaccessor.getconnectiontxpair(idbprovider provider) 16:16:20 @ spring.data.core.adotemplate.execute(icommandcallback action) 16:16:20 @ spring.data.core.adotemplate.executenonquery(commandtype cmdtype, string cmdtext) 16:16:20 @ product.core.sqlserver.componentdao.truncate() in c:\jenkins\workspace\...\corelib\sqlserver\componentdao.cs:line 133 16:16:20 @ product.corelib.tests.data.componentdaotest.setup() in c:\jenkins\workspace\...\corelib.tests\data\componentdaotest.cs:line 39 16:16:20 --sqlexception 16:16:20 @ system.data.providerbase.dbconnectionpool.trygetconnection(dbconnection owningobject, uint32 waitformultipleobjectstimeout, boolean allowcreate, boolean onlyonecheckconnection, dbconnectionoptions useroptions, dbconnectioninternal& connection) 16:16:20 @ system.data.providerbase.dbconnectionpool.trygetconnection(dbconnection owningobject, taskcompletionsource`1 retry, dbconnectionoptions useroptions, dbconnectioninternal& connection) 16:16:20 @ system.data.providerbase.dbconnectionfactory.trygetconnection(dbconnection owningconnection, taskcompletionsource`1 retry, dbconnectionoptions useroptions, dbconnectioninternal oldconnection, dbconnectioninternal& connection) 16:16:20 @ system.data.providerbase.dbconnectioninternal.tryopenconnectioninternal(dbconnection outerconnection, dbconnectionfactory connectionfactory, taskcompletionsource`1 retry, dbconnectionoptions useroptions) 16:16:20 @ system.data.providerbase.dbconnectionclosed.tryopenconnection(dbconnection outerconnection, dbconnectionfactory connectionfactory, taskcompletionsource`1 retry, dbconnectionoptions useroptions) 16:16:20 @ system.data.sqlclient.sqlconnection.tryopeninner(taskcompletionsource`1 retry) 16:16:20 @ system.data.sqlclient.sqlconnection.tryopen(taskcompletionsource`1 retry) 16:16:20 @ system.data.sqlclient.sqlconnection.open() 16:16:20 @ spring.data.support.connectionutils.dogetconnection(idbprovider provider) 16:16:20 @ spring.data.support.connectionutils.getconnectiontxpair(idbprovider provider) 16:16:20 --win32exception 16:16:20 16:16:20 --teardown 16:16:20 @ spring.data.support.connectionutils.getconnectiontxpair(idbprovider provider) 16:16:20 @ spring.data.core.adoaccessor.getconnectiontxpair(idbprovider provider) 16:16:20 @ spring.data.core.adotemplate.execute(icommandcallback action) 16:16:20 @ spring.data.core.adotemplate.executenonquery(commandtype cmdtype, string cmdtext) 16:16:20 @ product.core.sqlserver.componentdao.truncate() in c:\jenkins\workspace\...\corelib\sqlserver\componentdao.cs:line 133 16:16:20 @ product.corelib.tests.data.componentdaotest.complete() in c:\jenkins\workspace\...\corelib.tests\data\componentdaotest.cs:line 48 16:16:20 --sqlexception 16:16:20 @ system.data.providerbase.dbconnectionpool.trygetconnection(dbconnection owningobject, uint32 waitformultipleobjectstimeout, boolean allowcreate, boolean onlyonecheckconnection, dbconnectionoptions useroptions, dbconnectioninternal& connection) 16:16:20 @ system.data.providerbase.dbconnectionpool.trygetconnection(dbconnection owningobject, taskcompletionsource`1 retry, dbconnectionoptions useroptions, dbconnectioninternal& connection) 16:16:20 @ system.data.providerbase.dbconnectionfactory.trygetconnection(dbconnection owningconnection, taskcompletionsource`1 retry, dbconnectionoptions useroptions, dbconnectioninternal oldconnection, dbconnectioninternal& connection) 16:16:20 @ system.data.providerbase.dbconnectioninternal.tryopenconnectioninternal(dbconnection outerconnection, dbconnectionfactory connectionfactory, taskcompletionsource`1 retry, dbconnectionoptions useroptions) 16:16:20 @ system.data.providerbase.dbconnectionclosed.tryopenconnection(dbconnection outerconnection, dbconnectionfactory connectionfactory, taskcompletionsource`1 retry, dbconnectionoptions useroptions) 16:16:20 @ system.data.sqlclient.sqlconnection.tryopeninner(taskcompletionsource`1 retry) 16:16:20 @ system.data.sqlclient.sqlconnection.tryopen(taskcompletionsource`1 retry) 16:16:20 @ system.data.sqlclient.sqlconnection.open() 16:16:20 @ spring.data.support.connectionutils.dogetconnection(idbprovider provider) 16:16:20 @ spring.data.support.connectionutils.getconnectiontxpair(idbprovider provider) 16:16:20 --win32exception
i guess tests using same ado connection same localdb database configured in context.xml, thing is, run without error. these tests have not been changed in long time, on , off failure puzzling us.
Comments
Post a Comment