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
Operations

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: 03/Dec/12 09:39 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

Time Tracking:
Not Specified

Issue Links:
Relate

Planning Status: Unspecified


 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   Work Log   Change History   Version Control   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 ?

Thanks!
--
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.