when execute multi query on same time on sql serv using threading get error 40 ?

  • I work on unity csharp . i try to execute multi query on sql sever database using async await threading on same time but i get error sql

    so How to solve this error please and why this error generated and reasons for that

    SqlException: Snix_Connect (provider: SNI_PN7, error: 40 - SNI_ERROR_40)

    Snix_Connect (provider: SNI_PN7, error: 40 - SNI_ERROR_40)

    System.Data.SqlClient.SqlInternalConnectionTds..ctor (System.Data.ProviderBase.DbConnectionPoolIdentity identity, System.Data.SqlClient.SqlConnectionString connectionOptions, System.Object providerInfo, System.Boolean redirectedUserInstance, System.Data.SqlClient.SqlConnectionString userConnectionOptions, System.Data.SqlClient.SessionData reconnectSessionData, System.Boolean applyTransientFaultHandling) (at <290425a50ff84a639f8c060e2d4530f6>:0)

    System.Data.SqlClient.SqlConnectionFactory.CreateConnection (System.Data.Common.DbConnectionOptions options, System.Data.Common.DbConnectionPoolKey poolKey, System.Object poolGroupProviderInfo, System.Data.ProviderBase.DbConnectionPool pool, System.Data.Common.DbConnection owningConnection, System.Data.Common.DbConnectionOptions userOptions) (at <290425a50ff84a639f8c060e2d4530f6>:0)

    System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection (System.Data.Common.DbConnection owningConnection, System.Data.ProviderBase.DbConnectionPoolGroup poolGroup, System.Data.Common.DbConnectionOptions userOptions) (at <290425a50ff84a639f8c060e2d4530f6>:0)

    System.Data.ProviderBase.DbConnectionFactory.TryGetConnection (System.Data.Common.DbConnection owningConnection, System.Threading.Tasks.TaskCompletionSource`1[TResult] retry, System.Data.Common.DbConnectionOptions userOptions, System.Data.ProviderBase.DbConnectionInternal oldConnection, System.Data.ProviderBase.DbConnectionInternal& connection) (at <290425a50ff84a639f8c060e2d4530f6>:0)

    System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal (System.Data.Common.DbConnection outerConnection, System.Data.ProviderBase.DbConnectionFactory connectionFactory, System.Threading.Tasks.TaskCompletionSource`1[TResult] retry, System.Data.Common.DbConnectionOptions userOptions) (at <290425a50ff84a639f8c060e2d4530f6>:0)

    System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection (System.Data.Common.DbConnection outerConnection, System.Data.ProviderBase.DbConnectionFactory connectionFactory, System.Threading.Tasks.TaskCompletionSource`1[TResult] retry, System.Data.Common.DbConnectionOptions userOptions) (at <290425a50ff84a639f8c060e2d4530f6>:0)

    System.Data.SqlClient.SqlConnection.TryOpen (System.Threading.Tasks.TaskCompletionSource`1[TResult] retry) (at <290425a50ff84a639f8c060e2d4530f6>:0)

    System.Data.SqlClient.SqlConnection.Open () (at <290425a50ff84a639f8c060e2d4530f6>:0)

    System.Data.Common.DbDataAdapter.QuietOpen (System.Data.IDbConnection connection, System.Data.ConnectionState& originalState) (at <290425a50ff84a639f8c060e2d4530f6>:0)

    System.Data.Common.DbDataAdapter.FillInternal (System.Data.DataSet dataset, System.Data.DataTable[] datatables, System.Int32 startRecord, System.Int32 maxRecords, System.String srcTable, System.Data.IDbCommand command, System.Data.CommandBehavior behavior) (at <290425a50ff84a639f8c060e2d4530f6>:0)

    System.Data.Common.DbDataAdapter.Fill (System.Data.DataTable[] dataTables, System.Int32 startRecord, System.Int32 maxRecords, System.Data.IDbCommand command, System.Data.CommandBehavior behavior) (at <290425a50ff84a639f8c060e2d4530f6>:0)

    System.Data.Common.DbDataAdapter.Fill (System.Data.DataTable dataTable) (at <290425a50ff84a639f8c060e2d4530f6>:0)

    (wrapper remoting-invoke-with-check) System.Data.Common.DbDataAdapter.Fill(System.Data.DataTable)

    StockUpdate.ProcessUpdateTask (TextureContainer textureContainer, System.Collections.Generic.List`1[T] assignedShelfFaceDatas, Automation automation, UnionCoop.Core.data.Stock stock) (at <572a6c74c0474fd7ae89cf224552a56e>:0)

    StockUpdate+<>c__DisplayClass10_4.<UpdateVirtualStoreAsync>b__6 () (at <572a6c74c0474fd7ae89cf224552a56e>:0)

    System.Threading.Tasks.Task`1[TResult].InnerInvoke () (at <eae584ce26bc40229c1b1aa476bfa589>:0)

    System.Threading.Tasks.Task.Execute () (at <eae584ce26bc40229c1b1aa476bfa589>:0)

    --- End of stack trace from previous location where exception was thrown ---

    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <eae584ce26bc40229c1b1aa476bfa589>:0)

    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) (at <eae584ce26bc40229c1b1aa476bfa589>:0)

    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) (at <eae584ce26bc40229c1b1aa476bfa589>:0)

    System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) (at <eae584ce26bc40229c1b1aa476bfa589>:0)

    System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () (at <eae584ce26bc40229c1b1aa476bfa589>:0)

    StockUpdate+<UpdateVirtualStoreAsync>d__10.MoveNext () (at <572a6c74c0474fd7ae89cf224552a56e>:0)

    --- End of stack trace from previous location where exception was thrown ---

    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <eae584ce26bc40229c1b1aa476bfa589>:0)

    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) (at <eae584ce26bc40229c1b1aa476bfa589>:0)

    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) (at <eae584ce26bc40229c1b1aa476bfa589>:0)

    System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) (at <eae584ce26bc40229c1b1aa476bfa589>:0)

    System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () (at <eae584ce26bc40229c1b1aa476bfa589>:0)

    Automation+<UpdateVirtualStore>d__69.MoveNext () (at <572a6c74c0474fd7ae89cf224552a56e>:0)

    --- End of stack trace from previous location where exception was thrown ---

    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <eae584ce26bc40229c1b1aa476bfa589>:0)

    System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) (at <eae584ce26bc40229c1b1aa476bfa589>:0)

    UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at <85d1d3e7744a4a47b5f51883bf40bba2>:0)

    UnityEngine.UnitySynchronizationContext:ExecuteTasks()
  • I can't see anything useful in that stack trace. Were there other error messages generated before the trace? Have you identified the exact statement which generates the error by running in debug? Does that give you any clues?

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • Maybe it's something wrong with FireFox but I see no "stack trace" in the original post.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jeff Moden wrote:

    Maybe it's something wrong with FireFox but I see no "stack trace" in the original post.

    Here's a plain-text version for your delight:

    SqlException: Snix_Connect (provider: SNI_PN7, error: 40 - SNI_ERROR_40)

    Snix_Connect (provider: SNI_PN7, error: 40 - SNI_ERROR_40)

    System.Data.SqlClient.SqlInternalConnectionTds..ctor (System.Data.ProviderBase.DbConnectionPoolIdentity identity, System.Data.SqlClient.SqlConnectionString connectionOptions, System.Object providerInfo, System.Boolean redirectedUserInstance, System.Data.SqlClient.SqlConnectionString userConnectionOptions, System.Data.SqlClient.SessionData reconnectSessionData, System.Boolean applyTransientFaultHandling) (at <290425a50ff84a639f8c060e2d4530f6>:0)

    System.Data.SqlClient.SqlConnectionFactory.CreateConnection (System.Data.Common.DbConnectionOptions options, System.Data.Common.DbConnectionPoolKey poolKey, System.Object poolGroupProviderInfo, System.Data.ProviderBase.DbConnectionPool pool, System.Data.Common.DbConnection owningConnection, System.Data.Common.DbConnectionOptions userOptions) (at <290425a50ff84a639f8c060e2d4530f6>:0)

    System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection (System.Data.Common.DbConnection owningConnection, System.Data.ProviderBase.DbConnectionPoolGroup poolGroup, System.Data.Common.DbConnectionOptions userOptions) (at <290425a50ff84a639f8c060e2d4530f6>:0)

    System.Data.ProviderBase.DbConnectionFactory.TryGetConnection (System.Data.Common.DbConnection owningConnection, System.Threading.Tasks.TaskCompletionSource`1[TResult] retry, System.Data.Common.DbConnectionOptions userOptions, System.Data.ProviderBase.DbConnectionInternal oldConnection, System.Data.ProviderBase.DbConnectionInternal& connection) (at <290425a50ff84a639f8c060e2d4530f6>:0)

    System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal (System.Data.Common.DbConnection outerConnection, System.Data.ProviderBase.DbConnectionFactory connectionFactory, System.Threading.Tasks.TaskCompletionSource`1[TResult] retry, System.Data.Common.DbConnectionOptions userOptions) (at <290425a50ff84a639f8c060e2d4530f6>:0)

    System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection (System.Data.Common.DbConnection outerConnection, System.Data.ProviderBase.DbConnectionFactory connectionFactory, System.Threading.Tasks.TaskCompletionSource`1[TResult] retry, System.Data.Common.DbConnectionOptions userOptions) (at <290425a50ff84a639f8c060e2d4530f6>:0)

    System.Data.SqlClient.SqlConnection.TryOpen (System.Threading.Tasks.TaskCompletionSource`1[TResult] retry) (at <290425a50ff84a639f8c060e2d4530f6>:0)

    System.Data.SqlClient.SqlConnection.Open () (at <290425a50ff84a639f8c060e2d4530f6>:0)

    System.Data.Common.DbDataAdapter.QuietOpen (System.Data.IDbConnection connection, System.Data.ConnectionState& originalState) (at <290425a50ff84a639f8c060e2d4530f6>:0)

    System.Data.Common.DbDataAdapter.FillInternal (System.Data.DataSet dataset, System.Data.DataTable[] datatables, System.Int32 startRecord, System.Int32 maxRecords, System.String srcTable, System.Data.IDbCommand command, System.Data.CommandBehavior behavior) (at <290425a50ff84a639f8c060e2d4530f6>:0)

    System.Data.Common.DbDataAdapter.Fill (System.Data.DataTable[] dataTables, System.Int32 startRecord, System.Int32 maxRecords, System.Data.IDbCommand command, System.Data.CommandBehavior behavior) (at <290425a50ff84a639f8c060e2d4530f6>:0)

    System.Data.Common.DbDataAdapter.Fill (System.Data.DataTable dataTable) (at <290425a50ff84a639f8c060e2d4530f6>:0)

    (wrapper remoting-invoke-with-check) System.Data.Common.DbDataAdapter.Fill(System.Data.DataTable)

    StockUpdate.ProcessUpdateTask (TextureContainer textureContainer, System.Collections.Generic.List`1[T] assignedShelfFaceDatas, Automation automation, UnionCoop.Core.data.Stock stock) (at <572a6c74c0474fd7ae89cf224552a56e>:0)

    StockUpdate+<>c__DisplayClass10_4.<UpdateVirtualStoreAsync>b__6 () (at <572a6c74c0474fd7ae89cf224552a56e>:0)

    System.Threading.Tasks.Task`1[TResult].InnerInvoke () (at <eae584ce26bc40229c1b1aa476bfa589>:0)

    System.Threading.Tasks.Task.Execute () (at <eae584ce26bc40229c1b1aa476bfa589>:0)

    --- End of stack trace from previous location where exception was thrown ---

    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <eae584ce26bc40229c1b1aa476bfa589>:0)

    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) (at <eae584ce26bc40229c1b1aa476bfa589>:0)

    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) (at <eae584ce26bc40229c1b1aa476bfa589>:0)

    System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) (at <eae584ce26bc40229c1b1aa476bfa589>:0)

    System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () (at <eae584ce26bc40229c1b1aa476bfa589>:0)

    StockUpdate+<UpdateVirtualStoreAsync>d__10.MoveNext () (at <572a6c74c0474fd7ae89cf224552a56e>:0)

    --- End of stack trace from previous location where exception was thrown ---

    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <eae584ce26bc40229c1b1aa476bfa589>:0)

    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) (at <eae584ce26bc40229c1b1aa476bfa589>:0)

    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) (at <eae584ce26bc40229c1b1aa476bfa589>:0)

    System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) (at <eae584ce26bc40229c1b1aa476bfa589>:0)

    System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () (at <eae584ce26bc40229c1b1aa476bfa589>:0)

    Automation+<UpdateVirtualStore>d__69.MoveNext () (at <572a6c74c0474fd7ae89cf224552a56e>:0)

    --- End of stack trace from previous location where exception was thrown ---

    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <eae584ce26bc40229c1b1aa476bfa589>:0)

    System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) (at <eae584ce26bc40229c1b1aa476bfa589>:0)

    UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at <85d1d3e7744a4a47b5f51883bf40bba2>:0)

    UnityEngine.UnitySynchronizationContext:ExecuteTasks()

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • Heh... you were right, Phil.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply