Opened 15 years ago

Closed 15 years ago

#939 closed defect (fixed)

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

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 (last modified by bennylp)

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, ("", "Never gets called"));
};

leads to an endless loop:

INFO: 08:58:50.682          throwing signal 101 now
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 (4)

comment:1 Changed 15 years ago by bennylp

  • Description modified (diff)

comment:2 Changed 15 years ago by bennylp

  • Description modified (diff)

comment:3 Changed 15 years ago by bennylp

  • Description modified (diff)

comment:4 Changed 15 years ago by bennylp

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in r2878:

  • exception handler is now popped from the stack immediately in PJ_THROW
Note: See TracTickets for help on using tickets.