BUG: AV in Query w/Subselect on View w/JOIN and FORCEPLAN Is On

Last reviewed: November 10, 1997
Article ID: Q176493
The information in this article applies to:
  • Microsoft SQL Server version 6.5
BUG #: 17418 (WINDOWS: 6.50)

SYMPTOMS

A handled access violation (AV) may occur if all of the following conditions are true:

  • A query references a view.
  • The view contains a join.
  • The query contains a subselect.
  • SET FORCEPLAN ON was run before the query.

If all of these conditions are true, a DB-Library client may receive the following error:

   DB-Library Process Dead - Connection Broken

An ODBC client may receive the following error:

   [Microsoft][ODBC SQL Server Driver]Protocol error in TDS stream

You may see in the SQL Server error log messages similar to the following:

   EXCEPTION_ACCESS_VIOLATION raised, attempting to create symptom dump
   Initializing symptom dump and stack dump facilities
   ***BEGIN STACK TRACE***
   0x0042F2C8 in sqlservr.EXE, newlinklock() + 0x0418
   0x00433717 in sqlservr.EXE, opendb() + 0x00F7
   0x0042ED45 in sqlservr.EXE, check_deadlock() + 0x0675
   0x0042EFA8 in sqlservr.EXE, newlinklock() + 0x00F8
   0x00423B50 in sqlservr.EXE, dbswriteflush() + 0x0160
   0x004229BD in sqlservr.EXE, dbswritecheck() + 0x07AD
   0x0040E680 in sqlservr.EXE, ksconsole() + 0x0320
   0x0040F1E5 in sqlservr.EXE, initcfgfix() + 0x03D5
   0x0040ED45 in sqlservr.EXE, initconfig() + 0x0165
   0x0040B7B2 in sqlservr.EXE, SqlDumpLocks() + 0x0052
   0x00415217 in sqlservr.EXE, udasyncwrite() + 0x0187

WORKAROUND

To work around this problem, do either of the following:

  • Do not use SET FORCEPLAN ON for the query.

    -or-

  • Change the query to avoid one of the other causes. For the most part, you can do this by using a join instead of a subselect.

STATUS

Microsoft has confirmed this to be a problem in SQL Server version 6.5. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Steps to Reproduce the Problem

  1. Create the view:

          use pubs
          go
          create view v1 AS
          select ta.title_id, t.pub_id
          from titleauthor ta
          inner join titles t on t.title_id = ta.title_id
    

  2. Use the following query to cause an AV:

          set forceplan on
          select distinct * from v1
          where pub_id in (select pub_id from publishers)
          set forceplan off
    

The following query can be used for a workaround:

   set forceplan on
   select distinct v1.* from v1
   inner join publishers p on v1.pub_id=p.pub_id
   set forceplan off


Additional query words: joinorder join order exception
Keywords : kbbug6.50 SSrvTran_SQL kbusage
Version : WINNT:6.5
Platform : WINDOWS
Issue type : kbbug
Solution Type : kbworkaround


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: November 10, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.