Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server crashes when it run SQL [CORE6137] #6386

Closed
firebird-automations opened this issue Sep 4, 2019 · 13 comments
Closed

Server crashes when it run SQL [CORE6137] #6386

firebird-automations opened this issue Sep 4, 2019 · 13 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Vadim Mescheryakov (vadimmescheryakov)

Attachments:
test_tmp_labelbarcode.rar
test_tmp_labelbarcode.sql

Votes: 3

Server crashes when it runs SQL.

Error:
Unsuccessful execution caused by a system error that precludes successful execution of subsequent statements.
internal Firebird consistency check (can't continue after bugcheck).

SQL:

select tmp_labelbarcode.BARCODE
from tmp_labelbarcode
where tmp_labelbarcode.BARCODE = '462713603936820000004620016596753'
order by tmp_labelbarcode.BARCODE

Table

CREATE TABLE TMP_LABELBARCODE (
ID INTEGER NOT NULL,
BARCODE CHAR(20) NOT NULL,
IDLABEL INTEGER NOT NULL
);

ALTER TABLE TMP_LABELBARCODE ADD PRIMARY KEY (ID);
CREATE INDEX TMLB_BARCODE ON TMP_LABELBARCODE (BARCODE);
CREATE INDEX TMLB_IDLABEL ON TMP_LABELBARCODE (IDLABEL);
CREATE UNIQUE INDEX TMP_LABELBARCODE_IDX1 ON TMP_LABELBARCODE (BARCODE, IDLABEL);

Error is only table with data.
May be it depends on data in rows

Commits: b4b6a64 6bada8e 83396d5

@firebird-automations
Copy link
Collaborator Author

Commented by: Vadim Mescheryakov (vadimmescheryakov)

Script for creating database + table + filling data on table

@firebird-automations
Copy link
Collaborator Author

Modified by: Vadim Mescheryakov (vadimmescheryakov)

Attachment: test_tmp_labelbarcode.rar [ 13377 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: Vadim Mescheryakov (vadimmescheryakov)

This is smaller file with 10 records in table

@firebird-automations
Copy link
Collaborator Author

Modified by: Vadim Mescheryakov (vadimmescheryakov)

Attachment: test_tmp_labelbarcode.sql [ 13378 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: Vadim Mescheryakov (vadimmescheryakov)

Error presents if Table contains only one record;

INSERT INTO TMP_LABELBARCODE (ID, BARCODE, IDLABEL) VALUES (224423, '4627136039368', 278164);

@firebird-automations
Copy link
Collaborator Author

Commented by: @livius2

confirmed on WIndows
and it is not releated to chaset tested with WIN1250 and NONE - same error

Message: isc_dsql_fetch failed.

SQL Message : -902
Unsuccessful execution caused by a system error that precludes successful execution of subsequent statements

Engine Code : 335544333
Engine Message :
internal Firebird consistency check (invalid SEND request (167), file: JrdStatement.cpp line: 327)

------------------------------------------------------------------------------------------------------------------------------------------------------
in the source code it is

jrd_req* JrdStatement::findRequest(thread_db* tdbb)
{
SET_TDBB(tdbb);
Attachment* const attachment = tdbb->getAttachment();
const JrdStatement* const thisPointer = this; // avoid warning
if (!thisPointer)
BUGCHECK(167); /* msg 167 invalid SEND request */

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

assignee: Vlad Khorsun [ hvlad ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

The bug happens when
- optimizer is used index for navigation (PLAN ORDER)
- upper bound condition exists and used for the same index
- upper key length is greater than declared index key length

When all conditions above happens request impure area could be overwrited by bytes from upper key and it leads to the various problems.
In this case, index descriptor was dirtied, idx_expressn flag was set and engine tries to execute non-existing index expression.

The bug exists at least since v2.5

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

Fixed in v3 and v4, v2.5 will follow

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Open [ 1 ] => Open [ 1 ]

QA Status: No test => Done successfully

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

To reproduce on v2.5 problem query should be changed as

select tmp_labelbarcode.BARCODE
from tmp_labelbarcode
where tmp_labelbarcode.BARCODE < '562713603936820000004620016596753562713603936820000004620016596753'
order by tmp_labelbarcode.BARCODE;

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

Fix is commited into v2.5 too

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 3.0.5 [ 10885 ]

Fix Version: 4.0 Beta 2 [ 10888 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment