Error 17311 while trying to run query with OPENDATASOURCE

  • SQL Server 2016 SP2 terminates suddenly with the error id 17311. Here's the SQL dump error:

    2021-06-27 10:32:05.29 spid63 SqlDumpExceptionHandler: Process 63 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.

    2021-06-27 10:32:05.29 spid63 * *******************************************************************************

    2021-06-27 10:32:05.29 spid63 *

    2021-06-27 10:32:05.29 spid63 * BEGIN STACK DUMP:

    2021-06-27 10:32:05.29 spid63 * 06/27/21 10:32:05 spid 63

    2021-06-27 10:32:05.29 spid63 *

    2021-06-27 10:32:05.29 spid63 *

    2021-06-27 10:32:05.29 spid63 * Exception Address = 0000022AA229AEF8 Module(UNKNOWN+0000000000000000)

    2021-06-27 10:32:05.29 spid63 * Exception Code = c0000005 EXCEPTION_ACCESS_VIOLATION

    2021-06-27 10:32:05.29 spid63 * Access Violation occurred writing address 0000022AA229AEF8

    2021-06-27 10:32:05.29 spid63 * Input Buffer 510 bytes -

    2021-06-27 10:32:05.29 spid63 * INSERT INTO Utenti (Id,Email,EmailConfirmed,FirstName,Passwor

    2021-06-27 10:32:05.29 spid63 * dHash,SecurityStamp,PhoneNumber,PhoneNumberConfirmed,TwoFactorEnabled,Lo

    2021-06-27 10:32:05.29 spid63 * ckoutEndDateUtc,LockoutEnabled,AccessFailedCount,UserName,PasswordResetD

    2021-06-27 10:32:05.29 spid63 * ate,ConfirmationCode,Anagrafe_Id,Deleted,Assegnazioni_Id) SELECT Id,Emai

    2021-06-27 10:32:05.29 spid63 * l,EmailConfirmed,FirstName,PasswordHash,SecurityStamp,PhoneNumber,PhoneN

    2021-06-27 10:32:05.29 spid63 * umberConfirmed,TwoFactorEnabled,LockoutEndDateUtc,LockoutEnabled,AccessF

    2021-06-27 10:32:05.29 spid63 * ailedCount,UserName,PasswordResetDate,ConfirmationCode,Anagrafe_Id,Delet

    2021-06-27 10:32:05.29 spid63 * ed,Assegnazioni_Id FROM OPENDATASOURCE('SQLNCLI', 'Server=AZIENDA.database

    2021-06-27 10:32:05.29 spid63 * .windows.net;Initial Catalog=VendoOnlineHI1;Persist Security Info=False;

    2021-06-27 10:32:05.29 spid63 * User ID=***;Password=***;MultipleActiveResultSets=False;En

    2021-06-27 10:32:05.29 spid63 * crypt=True;TrustServerCertificate=False;Connection Timeout=120;').VendoO

    2021-06-27 10:32:05.29 spid63 * nlineHI1.dbo.Utenti WHERE CreatedAt > '26/06/2021 17:36:17 +02:00

    Also, here's another error:

    2021-02-28 22:50:26.86 spid58 Errore: 17311, gravità: 16, stato: 1.

    2021-02-28 22:50:26.86 spid58 SQL Server is terminating because of fatal exception 80000003. This error may be caused by an unhandled Win32 or C++ exception, or by an access violation encountered during exception handling. Check the SQL error log for any related stack dumps or messages. This exception forces SQL Server to shutdown. To recover from this error, restart the server (unless SQLAgent is configured to auto restart).

    2021-02-28 22:50:26.89 spid58 **Dump thread - spid = 0, EC = 0x0000000038AD0D90

    2021-02-28 22:50:26.91 spid58 ***Stack Dump being sent to C:\Program Files\Microsoft SQL Server\MSSQL12.SQLEXPRESS\MSSQL\LOG\SQLDump0094.txt

    2021-02-28 22:50:26.91 spid58 * *******************************************************************************

    2021-02-28 22:50:26.91 spid58 *

    2021-02-28 22:50:26.91 spid58 * BEGIN STACK DUMP:

    2021-02-28 22:50:26.91 spid58 * 02/28/21 22:50:26 spid 58

    2021-02-28 22:50:26.91 spid58 *

    2021-02-28 22:50:26.91 spid58 * ex_handle_except encountered exception 80000003 - Server terminating

    2021-02-28 22:50:26.91 spid58 *

    2021-02-28 22:50:26.91 spid58 * Input Buffer 510 bytes -

    2021-02-28 22:50:26.91 spid58 * INSERT INTO Anagrafe (Id,CodCli,Descrizione,PartitaIva,Indiri

    2021-02-28 22:50:26.91 spid58 * zzo,CAP,Localita,Prov,CodAli,Listino,Sconti,Note,Fido,FidoMax,Esposizion

    2021-02-28 22:50:26.91 spid58 * eMax,Esposizione,MaxOrdinabile,CreatedAt,UpdatedAt,Deleted,Aliquote_Id,B

    2021-02-28 22:50:26.91 spid58 * loccato,Nuovo,Soggetto,Nome,Cognome,Sesso,Telefono,Cellulare,CodiceFisca

    2021-02-28 22:50:26.91 spid58 * le,CodiceDestinatario,Privacy,CondizioniVendita) SELECT Id,CodCli,Descri

    2021-02-28 22:50:26.91 spid58 * zione,PartitaIva,Indirizzo,CAP,Localita,Prov,CodAli,Listino,Sconti,Note,

    2021-02-28 22:50:26.91 spid58 * Fido,FidoMax,EsposizioneMax,Esposizione,MaxOrdinabile,CreatedAt,UpdatedA

    2021-02-28 22:50:26.91 spid58 * t,Deleted,Aliquote_Id,Bloccato,Nuovo,Soggetto,Nome,Cognome,Sesso,Telefon

    2021-02-28 22:50:26.91 spid58 * o,Cellulare,CodiceFiscale,CodiceDestinatario,Privacy,CondizioniVendita F

    2021-02-28 22:50:26.91 spid58 * ROM OPENDATASOURCE('SQLNCLI', 'Server=***').myDb.dbo.Anagrafe WHERE CreatedAt > '25/02/2021 15:18:33 +00:00'

    This query is fired every 2 minutes, and almost always it works fine. The error happens once every 2/3 weeks. Datasource is a db which runs on SQLAzure.

    Is there something that I should do to fix this issue?

  • As a first step, make sure you are on the latest CU patch level.

    SQL DBA,SQL Server MVP(07, 08, 09) A socialist is someone who will give you the shirt off *someone else's* back.

  • The problem happens on SQLServer 2014 SP3 with latest CU (4) too.

    • This reply was modified 2 years, 10 months ago by  Denny. Reason: Type correction
  • Not sure I understand the architecture here. You say your datasource is a DB in Azure; is that Azure SQL Database, MI or a VM running MSSQL?

    Looking at the connection strings, you have at least two different data sources:

    OPENDATASOURCE('SQLNCLI', 'Server=AZIENDA.database.windows.net

    OPENDATASOURCE('SQLNCLI', 'Server=***').myDb.dbo.Anagrafe

    The first is probably an Azure SQL Database; the second...?

    Does the query run on-prem, and reads/writes to an Azure database? If yes, any special reason why you use OPENDATASOURCE?

    Have you tried creating a Linked Server?

    Or maybe re-architecting this completely, and run your code from ADF or Synapse?

    To start with, keeping things simple; try some different ways of connecting:

    "Azure SQL Database and Azure SQL Managed Instance connect and query articles"

    https://docs.microsoft.com/en-us/azure/azure-sql/database/connect-query-content-reference-guide

    If you can provide more info, maybe we can figure out what is happing.

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

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