Skip to content

Intermittent enclave session error using Always Encrypted w/ secure enclaves. #1422

@dna495

Description

@dna495
Microsoft.Data.SqlClient.EnclaveDelegate+RetryableEnclaveQueryExecutionException: Internal Error. Enclave session is null during query execution. Enclave type is 'SGX' and enclaveAttestationUrl is 'https://xxxxxxxxxxxxx.eus.attest.azure.net'.
 ---> System.ArgumentException: Internal Error. Enclave session is null during query execution. Enclave type is 'SGX' and enclaveAttestationUrl is 'https://xxxxxxxxxxxxx.eus.attest.azure.net'.
   at Microsoft.Data.SqlClient.EnclaveDelegate.GetEnclaveSession(SqlConnectionAttestationProtocol attestationProtocol, String enclaveType, EnclaveSessionParameters enclaveSessionParameters, Boolean generateCustomData, SqlEnclaveSession& sqlEnclaveSession, Int64& counter, Byte[]& customData, Int32& customDataLength, Boolean throwIfNull)
   at Microsoft.Data.SqlClient.EnclaveDelegate.GenerateEnclavePackage(SqlConnectionAttestationProtocol attestationProtocol, ConcurrentDictionary`2 keysToBeSentToEnclave, String queryText, String enclaveType, EnclaveSessionParameters enclaveSessionParameters, SqlConnection connection, SqlCommand command)
   --- End of inner exception stack trace ---
   at Microsoft.Data.SqlClient.EnclaveDelegate.GenerateEnclavePackage(SqlConnectionAttestationProtocol attestationProtocol, ConcurrentDictionary`2 keysToBeSentToEnclave, String queryText, String enclaveType, EnclaveSessionParameters enclaveSessionParameters, SqlConnection connection, SqlCommand command)
   at Microsoft.Data.SqlClient.SqlCommand.GenerateEnclavePackage()
   at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReaderTdsWithTransparentParameterEncryption(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean isAsync, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest, Task describeParameterEncryptionTask)
   at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry, String method)
   at Microsoft.Data.SqlClient.SqlCommand.BeginExecuteReaderInternal(CommandBehavior behavior, AsyncCallback callback, Object stateObject, Int32 timeout, Boolean inRetry, Boolean asyncWrite)
   at Microsoft.Data.SqlClient.SqlCommand.BeginExecuteReaderAsyncCallback(AsyncCallback callback, Object stateObject)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncImpl(Func`3 beginMethod, Func`2 endFunction, Action`1 endAction, Object state, TaskCreationOptions creationOptions)
   at Microsoft.Data.SqlClient.SqlCommand.InternalExecuteReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)

To Reproduce
Behavior occurs intermittently with any command that references an encrypted column.

Further technical details
Microsoft.Data.SqlClient version: 4.0.0
.NET.Core 3.1
AzureSQL
Attestation Protocol: AAS

Screenshot - 2021-12-06T165845 683

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions