Project

General

Profile

Bug #10831

Incorrect handling of UNDO, RETURN ERROR <error> causes IllegalStateException to be thrown

Added by Ovidiu Maxiniuc 9 months ago. Updated 6 months ago.

Status:
Closed
Priority:
Normal
Target version:
-
Start date:
Due date:
% Done:

100%

billable:
No
vendor_id:
GCD
case_num:
version_reported:
version_resolved:
production:
No
env_name:
topics:

Related issues

Related to Base Language - Bug #4602: fixes for OO 4GL and structured error handling Review
Related to Base Language - Bug #10248: Issue on RETURN ERROR STATEMENT on non-void OO method Test

History

#1 Updated by Ovidiu Maxiniuc 9 months ago

  • Related to Bug #4602: fixes for OO 4GL and structured error handling added

#2 Updated by Ovidiu Maxiniuc 9 months ago

As noted in the title, there is a flaw in handling of statements UNDO, RETURN ERROR <error> if this occurs in a CATCH block.

The testcase looks like this:

CLASS C1:
    METHOD PUBLIC VOID m1(...):

        DEFINE VARIABLE hBuffer AS HANDLE NO-UNDO.
        CREATE BUFFER hBuffer FOR TABLE "inexistent-table". // one example which causes the oError exception to be thrown

        CATCH oError AS Progress.Lang.SysError :
            UNDO, RETURN ERROR NEW E1(oError). // E1 inherits AppError
        END CATCH.  

    END METHOD.
END CLASS.

The problem is that, at the moment the NEW E1(oError) is returned, the current block (that is CATCH) is used inside undoReturnErrorTopLevel(), causing the transaction manager to get confused, a second rollback is attempted (for outer block). As result, the following lines are printed in server's log:

SEVERE | com.goldencode.p2j.util.TransactionManager | ThreadName:Conversation [00000031:bogus] | There is already a pending rollback. Pending cause unavailable.
SEVERE | com.goldencode.p2j.util.TransactionManager | ThreadName:Conversation [00000031:bogus] | There is already a pending rollback. Current cause unavailable.
SEVERE | com.goldencode.p2j.util.TransactionManager | ThreadName:Conversation [00000031:bogus] | Abnormal end; original error:
java.lang.IllegalStateException: There is already a pending rollback.
    at com.goldencode.p2j.util.TransactionManager.rollbackWorker(TransactionManager.java:4369)
    at com.goldencode.p2j.util.TransactionManager.rollback(TransactionManager.java:4247)
    at com.goldencode.p2j.util.TransactionManager$TransactionHelper.rollback(TransactionManager.java:8877)
    at com.goldencode.p2j.util.TransactionManager$TransactionHelper.rollback(TransactionManager.java:8838)
    at com.goldencode.p2j.util.BlockManager.undoLeave(BlockManager.java:7902)
    at com.goldencode.p2j.util.BlockManager.processLegacyError(BlockManager.java:12372)
    at com.goldencode.p2j.util.BlockManager.processBody(BlockManager.java:9746)
    at com.goldencode.p2j.util.BlockManager.topLevelBlock(BlockManager.java:9342)
    at com.goldencode.p2j.util.BlockManager.internalProcedure(BlockManager.java:911)
    at <customer code>

Interesting enough, replacing the CATCH block with:

        CATCH oError AS Progress.Lang.SysError :
            UNDO, THROW NEW E1(oError). // E1 inherits AppError
        END CATCH.
will execute normally, no events being logged by the server.

#4 Updated by Ovidiu Maxiniuc 9 months ago

  • Status changed from New to WIP
  • % Done changed from 0 to 100

Task branch 10831a was created and the fix was committed. With r16262 the double rollback is gone and the exception is no longer reported.

#5 Updated by Ovidiu Maxiniuc 9 months ago

  • Status changed from WIP to Review

Please review.

#6 Updated by Teodor Gorghe 9 months ago

  • Related to Bug #10248: Issue on RETURN ERROR STATEMENT on non-void OO method added

#7 Updated by Ovidiu Maxiniuc 6 months ago

  • Assignee set to Ovidiu Maxiniuc

The branch 10831a was rebased to trunk/16359. Pushed up to revision 16360.

#8 Updated by Constantin Asofiei 6 months ago

  • Status changed from Review to Merge Pending

Ovidiu, please merge to trunk now.

#9 Updated by Ovidiu Maxiniuc 6 months ago

Branch 10831a was merged to trunk rev 16399 and archived.

#10 Updated by Ovidiu Maxiniuc 6 months ago

  • Status changed from Merge Pending to Internal Test

#11 Updated by Ovidiu Maxiniuc 6 months ago

  • Status changed from Internal Test to Test

#12 Updated by Constantin Asofiei 6 months ago

  • Status changed from Test to Closed

Also available in: Atom PDF