Issue Details (XML | Word | Printable)

Key: CORE-4656
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Dmitriy Starodubov
Reporter: Dmitriy Starodubov
Votes: 0
Watchers: 3
Operations

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

Server could hang during chasing dead record version

Created: 30/Dec/14 08:07 AM   Updated: 06/Nov/15 02:12 PM
Component/s: Engine
Affects Version/s: 2.5.2, 2.5.2 Update 1, 2.5.3, 3.0 Beta 1, 2.5.3 Update 1, 3.0 Beta 2, 3.0 RC1, 3.0 RC2
Fix Version/s: 3.0 Beta 2, 2.5.5

QA Status: Cannot be tested


 Description  « Hide
In VIO_chase_record_version:
if (!(rpb->rpb_flags & rpb_chained) && rpb->rpb_flags & rpb_gc_active)
{
if (!rpb->rpb_transaction_nr) {
state = tra_active;
}

if (state == tra_committed) {
state = TRA_pc_active(tdbb, rpb->rpb_transaction_nr) ? tra_precommitted : tra_dead;
}

if (state == tra_dead) {
rpb->rpb_flags &= ~rpb_gc_active;
}
}
If state is dead and record has rpb_gc_active flag turned on, this flag is reset and starts new iteration of chasing.
On new iteration if ATT_NO_CLEANUP flag turned on, version is read from disk again and compared with saved version:

record_param temp = *rpb;
...
    VIO_data(tdbb, rpb, pool);
    rpb->rpb_page = temp.rpb_page;
    rpb->rpb_line = temp.rpb_line;
    if (!(DPM_fetch(tdbb, rpb, LCK_read)))
    {
        if (!DPM_get(tdbb, rpb, LCK_read)) {
            return false;
        }
        break;
    }

    if (rpb->rpb_b_page != temp.rpb_b_page || rpb->rpb_b_line != temp.rpb_b_line ||
        rpb->rpb_f_page != temp.rpb_f_page || rpb->rpb_f_line != temp.rpb_f_line ||
        rpb->rpb_flags != temp.rpb_flags)
    {
        CCH_RELEASE(tdbb, &rpb->getWindow(tdbb));
        if (!DPM_get(tdbb, rpb, LCK_read)) {
            return false;
        }
        break;
    }
"rpb" and "temp" versions can differ only by rpb_gc_active flag which was reset from saved version on previous iteration. Because of this current version considered as changed and it processed again. And so on. Loop inside VIO_chase_record_version becomes infinite.

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Jesus Angel Garcia Zarco added a comment - 17/Jan/15 06:22 PM - edited
Will be fixed for 2.5.4?

I trink I have had this problem last week in one of our customers with 2.5.2 upd 1

Vlad Khorsun added a comment - 06/Nov/15 02:12 PM
Backported into v2.5.5