Opened 15 years ago

Last modified 15 years ago

#939 closed defect

Throwing exception inside exception handler will cause infinite loop (thanks Roman Puls for the report) — at Initial Version

Reported by: bennylp Owned by: bennylp
Priority: normal Milestone: release-1.4
Component: pjlib Version: trunk
Keywords: Cc:
Backport to 1.x milestone: Backported:

Description

The following snippet:

void test() 
{
    int id = 101;
    PJ_USE_EXCEPTION;
 
    PJ_TRY {
        PJ_LOG(3, ("", "throwing signal %d now", id));
        PJ_THROW(id);
    } PJ_CATCH_ANY {
        id = PJ_GET_EXCEPTION();
        PJ_LOG(3, ("", "caught and reraising %d", id));
        PJ_THROW(id);
    } PJ_END;
 
    PJ_LOG(3, ("catch", "Never gets called"));
};

leads to an endless loop:

{{{
INFO: 08:58:50.682          throwing signal 101
INFO: 08:58:50.682          caught and reraising 101
INFO: 08:58:50.682          caught and reraising 101
INFO: 08:58:50.682          caught and reraising 101
...
}}}

Thanks Roman Puls for the report.

Change History (0)

Note: See TracTickets for help on using tickets.