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

Bugcheсk 300 (can't find shared latch) [CORE3034] #3415

Closed
firebird-automations opened this issue Jun 8, 2010 · 10 comments
Closed

Bugcheсk 300 (can't find shared latch) [CORE3034] #3415

firebird-automations opened this issue Jun 8, 2010 · 10 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @hvlad

Is related to CORE1257
Relate to CORE4004

When some request while inserting key into expression index is cancelled (due to database shutdown or by user request) it could lead to bugcheck 300.

The reason is that IDX_store() holds lock for IRT page when calls BTR_key() and call chain could contain JRD_reschedule() which will throw exception and call CCH_unwind() if attachment (or transaction) was cancelled.
CCH_unwind() will release all page locks and latches and when IDX_store() will try to release IRT page it will trigger bugcheck 300 in CCH\release_bdb().

The sample call stack when JRD_reschedule() is called :

> fb_inet_server.exe!JRD_reschedule(Jrd::thread_db * tdbb=0x0331f510, long quantum=0, bool punt=true) Line 4070 C++
fb_inet_server.exe!EVL_expr(Jrd::thread_db * tdbb=0x0331f510, Jrd::jrd_nod * const node=0x0419c468) Line 824 + 0xd bytes C++
fb_inet_server.exe!BTR_eval_expression(Jrd::thread_db * tdbb=0x0331f510, Jrd::index_desc * idx=0x0331dc80, Jrd::Record * record=0x041c30f8, bool & notNull=true) Line 526 + 0x10 bytes C++
fb_inet_server.exe!BTR_key(Jrd::thread_db * tdbb=0x0331f510, Jrd::jrd_rel * relation=0x04062110, Jrd::Record * record=0x041c30f8, Jrd::index_desc * idx=0x0331dc80, Jrd::temporary_key * key=0x0331dd3c, Jrd::idx_null_state * null_state=0x00000000, const bool fuzzy=false) Line 1212 + 0x18 bytes C++
fb_inet_server.exe!IDX_store(Jrd::thread_db * tdbb=0x0331f510, Jrd::record_param * rpb=0x040dc390, Jrd::jrd_tra * transaction=0x040c5fcc, Jrd::jrd_rel * * bad_relation=0x0331ed84, unsigned short * bad_index=0x0331ed90) Line 986 + 0x29 bytes C++

The main bug is that JRD_reschedule() should not be called if thread holds any LM's lock ! So, bug exists al long as expression indices was enabled.

Commits: 7012311 543b507 f0a965e 8783fe1

====== Test Details ======

Could not reproduce on 2.1.3 Classic (and could not find 2.5 Alpha 1, 2.5 Beta 1, 2.5 Beta 2, 2.5 RC1, 2.5 RC2 snapshots).

DDL:

SQL> recreate table test(x int, y int, z int);
SQL> create index test_sum on test computed by(x+y-z);
SQL> commit;

Then:

window #⁠1

C:\MIX\firebird\QA\fbt-repo\tmp>C:\MIX\firebird\oldfb213\bin\isql localhost/3213:e21
Database: localhost/3213:e21
SQL> insert into test select rand()*100, rand()*100, rand()*100 from rdb$types,rdb$types,rdb$types;

window #⁠2

gfix -shut full -force 0 localhost/3213:e21

window #⁠1
Statement failed, SQLSTATE = -902
Unable to complete network request to host "localhost".
-Error writing data to the connection.

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

assignee: Vlad Khorsun [ hvlad ]

@firebird-automations
Copy link
Collaborator Author

Commented by: Kuznetsov Eugene (eugene)

> Affects Versions: 2.5 RC2, 2.5 RC1, 2.5 Beta 2, 2.5 Beta 1, 2.5 Alpha 1
> ....
> So, bug exists al long as expression indices was enabled.

And 2.0.x and 2.1.x are also affected (CORE1257)
Won't it be backported into 2.1.4 ?

Thanks!
--
Best regards, Eugene

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

Link: This issue is related to CORE1257 [ CORE1257 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

> Won't it be backported into 2.1.4 ?

Sooner of all - yes. But fix is still not ready.

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

Fix Version: 2.5 RC3 [ 10381 ]

summary: Bugchek 300 (can't find shared latch) => Bugcheсk 300 (can't find shared latch)

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

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

resolution: Fixed [ 1 ]

Fix Version: 2.1.4 [ 10361 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

Link: This issue relate to CORE4004 [ CORE4004 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

QA Status: No test

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Closed [ 6 ] => Closed [ 6 ]

QA Status: No test => Not enough information

Test Details: Could not reproduce on 2.1.3 Classic (and could not find 2.5 Alpha 1, 2.5 Beta 1, 2.5 Beta 2, 2.5 RC1, 2.5 RC2 snapshots).

DDL:

SQL> recreate table test(x int, y int, z int);
SQL> create index test_sum on test computed by(x+y-z);
SQL> commit;

Then:

window #⁠1

C:\MIX\firebird\QA\fbt-repo\tmp>C:\MIX\firebird\oldfb213\bin\isql localhost/3213:e21
Database: localhost/3213:e21
SQL> insert into test select rand()*100, rand()*100, rand()*100 from rdb$types,rdb$types,rdb$types;

window #⁠2

gfix -shut full -force 0 localhost/3213:e21

window #⁠1
Statement failed, SQLSTATE = -902
Unable to complete network request to host "localhost".
-Error writing data to the connection.

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