[SQL Server] -BUG cause error 3624

SQL Server Management afraid to see the error 823, 824, 1788x, 3624 ....... and other major mistake,
once the occurrence always takes quite a bit of effort to deal with, and even the possibility of data loss.
However, today, I stepped on a mine, not a 3624 error has occurred 3624 ......


Colin Colin 2 53 2017-11-22T17:01:00Z 2017-11-22T17:01:00Z 5 855 4876 40 11 5720 15.00 Clean Clean false 0 2 false false false EN-US ZH-TW X-NONE

PS. In this paper the problem has been fixed in Server 2016 SQL .

https://connect.microsoft.com/SQLServer/feedback/details/2936151/assertion-failure-when-using-option-recompile-with-an-invalid-offset-clause

I believe in regular SQL Server management personnel, for SQL Server, code-named several major errors will not be unfamiliar, such as 823, 824, 605, 1788x, 3624, all of which represent the, or to go SQL Server Instance in question, Well to be abnormal resource database (Memory, Physical Disk) occur, or save the database object error occurred. in most cases, these errors must be further analyzed through DBCC CHECKDB, SQL DUMP problems, and most of the cases and thorough had to rescue restore backup data.

Today is a big step on mine, situations like this ......

Is preparing to meet after work at the same time, an error message box jump shots from the application, is to specify the application when executing a branch Procedure, will not happen fixed SQL exception ERROR 3624. see this error, the moment the hearts of plush, this ....... it will not be an exception database!

When all the errors in Google, but because in the past have met several times this error, simply find directly on the DBA, ask them DBCC CHECKDB checks - for the majority of the article is to say, first check the DBCC CHECKDB However, DBCC CHECKDB is not unusual ...... very wonderful to say.

After a data table and then do a DBCC CHECKTABLE, turned out to have normal ...... Fortunately, error 3624 will produce dump, I believe this error is nothing to do with the nature of DB (Although he still plush). Go back dump, point occurred in the procedure execution phase, the program will check, taking a closer look at all like a problem.

Until ...... go into a parameter, find the cause of the error is caused by a combination of the following

* Process have to use option (recompile)

* Use offset ... fetch next ... rows

* And the offset into the value is negative.

Direct look at this issue reproduce it

use DEMO;

go

- Create test data table

create table tbl_test

(c1 int, c2 varchar(10));

go

- Write test data

insert into tbl_test values (1, 'a'),(2,'b'),(3,'c');

go

- a common case, pagination

- establish procedure

create procedure page_list

@page int,

@size int

as

begin

    select * from tbl_test

    order by c1 asc

    offset (@page - 1) * @size rows fetch next @size rows only;

end

go

- tests are normal return

exec page_list 1,2;

/*

c1  c2

1   a

2   b

*/

exec page_list 2,2;

/*

c1  c2

3   c

*/

- in the OFFSET test negative

- error 10724

exec page_list 0,2;

/*

10742 message, the hierarchy 15, the state 1, the process page_list, row 7 [lotstart line 34]

The offset specified in a OFFSET clause may not be negative.

*/

At this point a mistake is to be expected, it will have a negative value is specified in the OFFSET 10724 error, but after adding option (recompile) is not the same.

- on the procedure added option (recompile)

alter procedure page_list

@page int,

@size int

as

begin

    select * from tbl_test

    order by c1 asc

    offset (@page - 1) * @size rows fetch next @size rows only

    option (recompile);

end

go

- once again into the negative

- At this time will pause => hit dump

- then an error

exec page_list 0,2;

/*

Location:   op_ppqte.cpp:12267

Expression: llSkip >= 0

SPID:       51

Process ID: 652

Message 3624, the hierarchy 20, the state 1, the process page_list, line 6 [lotstart row 52]

A system assertion check has failed. Check the SQL Server error log for details. Typically, an assertion failure is caused by a software bug or data corruption. To check for database corruption, consider running DBCC CHECKDB. If you agreed to send dumps to Microsoft during setup, a mini dump will be sent to Microsoft. An update might be available from Microsoft in the latest Service Pack or in a Hotfix from Technical Support.

Message 596, the hierarchy 21, the state 1, line 52

Cannot continue the execution because the session is in the kill state.

Message 0, level 20, state 0, row 52

A fatal error occurred on the current command. If there are any results, it must be discarded.

*/

Baffled why OFFSET coupled with the option (recompile) will lead to corruption, but also to dump out to play.

(Part of the dump)

Memory                              

MemoryLoad = 30%                    

Total Physical = 2047 MB            

Available Physical = 1413 MB        

Total Page File = 2431 MB           

Available Page File = 1714 MB       

MB Total Virtual = 134217727        

Available Virtual = 134212073 MB    

Dump thread - spid = 0, EC = 0x00000000F7F3AC60                                                               

*Stack Dump being sent to C:Program FilesMicrosoft SQL ServerMSSQL12.MSSQLSERVERMSSQLLOGSQLDump0001.txt 

* *                               

*                                                                                                                

* BEGIN STACK DUMP:                                                                                             

*   11/23/17 00:04:28 spid 51                                                                                   

*                                                                                                               

* Location: op_ppqte.cpp:12267                                                                                 

* Expression:   llSkip >= 0                                                                                      

* SPID:     51                                                                                                     

* Process ID:   652                                                                                              

*                                                                                                                

* Input Buffer 62 bytes -                                                                                       

*             exec page_list -4,2; 

Then the information from the parties, is to do the DBCC CHECKDB checks, but the test database was built, so there is a table inside ....... ...... how checks are not wrong.

- can be seen from the dump part ERRORLOG

- recommended that treatment with the error occurred

sp_readerrorlog

/*

Error: 17066, Severity: 16, State: 1.

SQL Server Assertion: File: , line=12267 Failed Assertion = 'llSkip >= 0'. This error may be timing-related. If the error persists after rerunning the statement, use DBCC CHECKDB to check the database for structural integrity, or restart the server to ensure in-memory data structures are not corrupted.

Error: 3624, Severity: 20, State: 1.

A system assertion check has failed. Check the SQL Server error log for details. Typically, an assertion failure is caused by a software bug or data corruption. To check for database corruption, consider running DBCC CHECKDB. If you agreed to send dumps to Microsoft during setup, a mini dump will be sent to Microsoft. An update might be available from Microsoft in the latest Service Pack or in a Hotfix from Technical Support. 

*/

Wanted to send a BUG or Design issue, this behavior is unlike ERROR 3624, eventually made BUG FIX documents also confirm that the same process has been fixed in SQL Server 2016.


Original: Large column  [SQL Server] -BUG cause error 3624


Guess you like

Origin www.cnblogs.com/petewell/p/11490090.html