0
1

I get an exception on Domain.Build (Perform mode), after a binary update.

Xtensive.Storage.StorageException: Error 'Unknown'. Original message: This SqlTransaction has completed; it is no longer usable. ---> System.InvalidOperationException: This SqlTransaction has completed; it is no longer usable.
   at System.Data.SqlClient.SqlTransaction.ZombieCheck()
   at System.Data.SqlClient.SqlTransaction.Rollback()
   at Xtensive.Sql.SqlConnection.Rollback()
   at Xtensive.Storage.Providers.Sql.Driver.RollbackTransaction(Session session, SqlConnection connection)
   --- End of inner exception stack trace ---
   at Xtensive.Storage.Providers.Sql.Driver.RollbackTransaction(Session session, SqlConnection connection)
   at Xtensive.Storage.Providers.Sql.SessionHandler.RollbackTransaction()
   at Xtensive.Storage.Session.RollbackTransaction(Transaction transaction)
   at Xtensive.Storage.Transaction.Rollback()
   at Xtensive.Storage.TransactionScope.Dispose()
   at Xtensive.Storage.Building.Builders.DomainBuilder.BuildDomain(DomainConfiguration configuration, DomainBuilderConfiguration builderConfiguration)
   at Xtensive.Storage.Upgrade.UpgradingDomainBuilder.BuildStageDomain(UpgradeStage stage)
   at Xtensive.Storage.Upgrade.UpgradingDomainBuilder.Build(DomainConfiguration configuration)
   at PersistenceModule.CreateDomain()

Old version of dataobjects 1.0.5887.272748, new version 1.0.6015.32474.

I’m doing an update of binaries (with a 4Go database to update with an Update handler) : I don’t know if it is important (data does not seem changed after reverting to old binaries).

Any idea or recommendation?

EDIT:

The original exception is a timeout exception (I should have guessed;) ) Is there a standard way to increase timeout during domain build? Is it possible you display a more meaningful exception in this case?

First exception:

System.Data.SqlClient.SqlException occurred
  Message=Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
  Source=.Net SqlClient Data Provider
  ErrorCode=-2146232060
  Class=11
  LineNumber=0
  Number=-2
  Procedure=""
  Server=localhost\SQLEXPRESS
  State=0
  StackTrace:
       at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
       at System.Data.SqlClient.TdsParserStateObject.ReadSniError(TdsParserStateObject stateObj, UInt32 error)
       at System.Data.SqlClient.TdsParserStateObject.ReadSni(DbAsyncResult asyncResult, TdsParserStateObject stateObj)
       at System.Data.SqlClient.TdsParserStateObject.ReadNetworkPacket()
       at System.Data.SqlClient.TdsParserStateObject.ReadBuffer()
       at System.Data.SqlClient.TdsParserStateObject.ReadByte()
       at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
       at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async)
       at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
       at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
       at Xtensive.Storage.Providers.Sql.Driver.ExecuteNonQuery(Session session, DbCommand command) in c:\Temp\DataObjects.Net\Xtensive.Storage\Xtensive.Storage.Providers.Sql\Driver.Operations.cs:line 138
  InnerException:

Call stack:

System.Data.dll!System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(string methodName = "ExecuteNonQuery", bool async = false) + 0x136 bytes 
System.Data.dll!System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(System.Data.Common.DbAsyncResult result = null, string methodName = "ExecuteNonQuery", bool sendToPipe = false) + 0x1bd bytes  
System.Data.dll!System.Data.SqlClient.SqlCommand.ExecuteNonQuery() + 0xa1 bytes 
Xtensive.Storage.Providers.Sql.dll!Xtensive.Storage.Providers.Sql.Driver.ExecuteNonQuery(Xtensive.Storage.Session session = null, System.Data.Common.DbCommand command = {System.Data.SqlClient.SqlCommand}) Line 138 + 0xb bytes   C#
Xtensive.Storage.Providers.Sql.dll!Xtensive.Storage.Providers.Sql.SchemaUpgradeHandler.Execute(System.Collections.Generic.IEnumerable<string> batch = Count = 260) Line 112 + 0x21 bytes    C#
Xtensive.Storage.Providers.Sql.dll!Xtensive.Storage.Providers.Sql.SchemaUpgradeHandler.UpgradeSchema(Xtensive.Modelling.Actions.ActionSequence upgradeActions = {Xtensive.Modelling.Actions.ActionSequence}, Xtensive.Storage.Indexing.Model.StorageInfo sourceSchema = ".", Xtensive.Storage.Indexing.Model.StorageInfo targetSchema = ".") Line 69    C#
Xtensive.Storage.dll!Xtensive.Storage.Building.Builders.DomainBuilder.SynchronizeSchema(Xtensive.Storage.Building.SchemaUpgradeMode schemaUpgradeMode = Perform) Line 354   C#
Xtensive.Storage.dll!Xtensive.Storage.Building.Builders.DomainBuilder.BuildDomain(Xtensive.Storage.Configuration.DomainConfiguration configuration = {Xtensive.Storage.Configuration.DomainConfiguration}, Xtensive.Storage.Building.Builders.DomainBuilderConfiguration builderConfiguration = {Xtensive.Storage.Building.Builders.DomainBuilderConfiguration}) Line 71    C#
Xtensive.Storage.dll!Xtensive.Storage.Upgrade.UpgradingDomainBuilder.BuildStageDomain(Xtensive.Storage.Upgrade.UpgradeStage stage = Upgrading) Line 82 + 0x2a bytes C#
Xtensive.Storage.dll!Xtensive.Storage.Upgrade.UpgradingDomainBuilder.Build(Xtensive.Storage.Configuration.DomainConfiguration configuration = {Xtensive.Storage.Configuration.DomainConfiguration}) Line 59 + 0xb bytes C#
Xtensive.Storage.dll!Xtensive.Storage.Domain.Build(Xtensive.Storage.Configuration.DomainConfiguration configuration = {Xtensive.Storage.Configuration.DomainConfiguration}) Line 225 + 0x9 bytes    C#

EDIT 2: I added the suggested code:

DomainConfiguration domainConfig = new DomainConfiguration(connectionUrl);

SessionConfiguration systemSessionConfig = domainConfig.Sessions.System;
if (systemSessionConfig == null)
{
  systemSessionConfig = new SessionConfiguration(WellKnown.Sessions.System);
  domainConfig.Sessions.Add(systemSessionConfig);
}
systemSessionConfig.DefaultCommandTimeout = 600; // 10 min.

But this isn't working either.

alt text

The command timeout seems not to be set.

Alex : I really need this solved : the upgrade must work with large database.

asked Sep 16 '10 at 09:20

olorin's gravatar image

olorin
356838489

edited Sep 20 '10 at 03:01


2 Answers:

To update a large domain use a longer comand timeout for system sessions:

    SessionConfiguration systemSessionConfig = domainConfig.Sessions.System;
    if (systemSessionConfig == null)
    {
      systemSessionConfig = new SessionConfiguration(WellKnown.Sessions.System);
      domainConfig.Sessions.Add(systemSessionConfig);
    }
    systemSessionConfig.DefaultCommandTimeout = 10 * 60; // 10 min

This works with build 6242

answered Oct 01 '10 at 11:16

olorin's gravatar image

olorin
356838489

I have only one idea: likely, there was some error that lead to rollback of transaction, but by some reason we missed this event (e.g. because exception was suppressed somewhere).

To check this, try switching to binaries from "Bin (Diagnostics)" folder (there are .PDBs, we'll be able to get line numbers) and run the build under debugger with "Break on any thrown CLR exception" settings ("Debug" - "Exceptions") and "Debug non-user code" (likely, it doesn't matter, since there will be .PDBs => user code).

If you'll find the exception causing the problem, please paste its .ToString() output here.

answered Sep 17 '10 at 01:19

Alex%20Yakunin's gravatar image

Alex Yakunin
29714412

Ok I'll try that.

(Sep 17 '10 at 03:12) olorin olorin's gravatar image

Here you go with detailed exception (EDIT)

(Sep 17 '10 at 04:07) olorin olorin's gravatar image

I've found no way to set command timeout during upgrade progress. This is not practical at all. Is it possible?

(Sep 17 '10 at 09:04) olorin olorin's gravatar image

You can specify it via DomainConfiguration - DO uses session with configuration named "System" on upgrade:

var dc = ...; // some DomainConfiguration
var sc = dc.Sessions.System;
if (sc==null) {
  sc = new SessionCOnfiguration(WellKnown.Sessions.System);
  dc.Sessions.Add(sc);
}
sc.CommandTimeout = 600; // 10 min.
...

You can do the same via app.config - use <session name="System" ...> element there.

(Sep 17 '10 at 10:04) Alex Yakunin Alex%20Yakunin's gravatar image

Also note SQL Server has TransactionTimeout, but this parameter can be specified only via ConnectionString (or using same-named parameter @ ConnectionUrl).

SessionConfiguration.ConnectionInfo allows to define both of them.

(Sep 17 '10 at 10:19) Alex Yakunin Alex%20Yakunin's gravatar image

Forgot to add - we'll fix the issue with original exception masking.

(Sep 17 '10 at 10:20) Alex Yakunin Alex%20Yakunin's gravatar image

Issue 816 is created.

(Sep 17 '10 at 10:22) Alex Yakunin Alex%20Yakunin's gravatar image

ALex: using the system session command didn't work. (cf edit)

(Sep 20 '10 at 03:01) olorin olorin's gravatar image

Try to set both:

  • CommandTimeout
  • "Connection Timeout" parameter in connection string (or via &Connection%20Timeout=... in connection URL). It is described as option controlling connection timeout, but I'd give it a try (just remember it could affect as well).

As far as I can judge, there are no more options controlling this.

(Sep 20 '10 at 04:23) Alex Yakunin Alex%20Yakunin's gravatar image

I tried all of this. The CommandTimeout of dbcommand is not set : in debugger I see '30', while I set 600 in session configuration. I think it may be an error in DO code, but I may be mistaken. Anyway this problem must be solved : the upgrade layer should be limited by the size of the db (save for migration duration)

(Sep 20 '10 at 10:27) olorin olorin's gravatar image

The issue is fixed in the latest nightly build (6242).

(Oct 01 '10 at 00:55) Alex Yakunin Alex%20Yakunin's gravatar image

Thanks Alex this works like a charm! 120000+ very complex objects updated (~4 GB). I feel better now that I've a real world worst case scenario (concerning the volume of data for our applciation) of update working :)

(Oct 01 '10 at 11:13) olorin olorin's gravatar image
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

powered by OSQA