Issue Details (XML | Word | Printable)

Key: CORE-3034
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Vlad Khorsun
Reporter: Vlad Khorsun
Votes: 0
Watchers: 1

If you were logged in you would be able to see more operations.
Firebird Core

Bugcheсk 300 (can't find shared latch)

Created: 08/Jun/10 07:30 PM   Updated: 05/Sep/16 04:42 AM
Component/s: Engine
Affects Version/s: 2.5 Alpha 1, 2.5 Beta 1, 2.5 Beta 2, 2.5 RC1, 2.5 RC2
Fix Version/s: 2.5 RC3, 2.1.4

Issue Links:

QA Status: 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).


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


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.

 Description  « Hide
  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.

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Kuznetsov Eugene added a comment - 10/Jun/10 05:23 PM
> 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 (CORE-1257)
Won't it be backported into 2.1.4 ?

Best regards, Eugene

Vlad Khorsun added a comment - 10/Jun/10 07:29 PM
> Won't it be backported into 2.1.4 ?

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