Bug #4602
fixes for OO 4GL and structured error handling
100%
Related issues
History
#1 Updated by Constantin Asofiei over 6 years ago
- Related to Feature #4373: finish core OO 4GL support added
#2 Updated by Constantin Asofiei over 6 years ago
From #4384-121:
I have FWD fixes for cases of 'nested' calls (for ctors, methods, internal procedures, dynamic functions), which cover
The other parts which needs to be covered in 4GL tests are:RETURN ERROR "foo",RETURN ERROR new AppError,UNDO, THROW ERRORand 'implicit' OE errors (like accessing an attribute in an unknown handle). These work, except the case forRETURN ERRORwith nested constructors and default error management (no ROUTINE/BLOCK-LEVEL statements): if this is called from a super-constructor, then 4GL behaves differently - unlike RUN (or other types of calls), the ERROR flag propagates up the stack, until it reaches theNEWoperator (and this makes sense, as the object needs to be 'invalidated', because the c'tor failed...); I haven't found a solution in FWD for this, yet.
- direct function calls
- dynamic new
- dynamic object method calls
- external programs
ON ERROR UNDO, THROWclauses.- error propagation in nested blocks
From these, I think only the last two may need explicit fixing - as it looks like the ERROR can be 'eaten' by a parent block, even if it doesn't have a CATCH block to treat it.
My tests are in testcases/uast/error_handling (must be converted from this folder, with links to ../cfg/ and ../data/). Marian's tests are in xfer testcases project, error_handling folder.
#3 Updated by Constantin Asofiei over 6 years ago
Another case to cover: simple statements with NO-ERROR, like ch = h:name NO-ERROR. and input from os-dir("missingdir"). This checks for server-side and client-side raised ERROR conditions.
#4 Updated by Constantin Asofiei over 6 years ago
Marian, a weird question: in case of argument validation errors for appserver calls, does the caller's block-level or ROUTINE-LEVEL UNDO, THROW option get 'transferred' to the remote side?
And also, I think I need to check what happens with errors from argument validation for non-appserver RUN (and such) calls.
#5 Updated by Marian Edu over 6 years ago
Constantin Asofiei wrote:
Marian, a weird question: in case of argument validation errors for appserver calls, does the caller's
block-levelorROUTINE-LEVEL UNDO, THROWoption get 'transferred' to the remote side?And also, I think I need to check what happens with errors from argument validation for non-appserver RUN (and such) calls.
Constantin, the ROUTINE-LEVEL, BLOCK-LEVEL as well as ON ERROR options do not 'travel' to the other end... it only affects the block on the caller end, if you run something on the appsrv that would lead to an error but that one is shielded by the lack of an ROUTINE-LEVEL, BLOCK-LEVEL on the server side business logic there is no way to influence that from the client side.
Since the remote call is inherently a dynamic call the parameter validation occurs before the remote method is actually executed, in that case an error is thrown back to the client and what happens on the client it depends on error handling on that end.
#6 Updated by Greg Shah over 6 years ago
I'm reproducing some discussion from #4349.
Greg Shah wrote:
Consider this code:
[...]
LegacyErrorExceptionextendsErrorConditionExceptionwhich is the equivalent or theERRORcondition in the 4GL. But this code bypasses theERROR-STATUSprocessing (recording error/warning state whenNO-ERRORis present. The proper processing forERROR-STATUSis done by theErrorManager.Marian wrote:
What we used, and seemed to work fine for our tests, is using
undoThrowfromBlockManageras in:undoThrow(SysError.newInstance(String.format("Invalid value specified for %s:GetEnum", ObjectOps.getLegacyName(enumClass)), 15246));
Greg wrote:
Please note that the code above will result in tracked objects (e.g. in the session object chain) being created for the exceptions. If this is necessary, then it will need some attention as well in
ErrorManager.Marian wrote:
This is correct, the error pop up the stack till is being
catchand if is not deleted in thatcatchblock it will linger in the session objects chain - eventually will be garbage collected at some point. It was recommended to delete error objects insidecatchblock, before they changed the recommendation to not delete anything anymore and let the GC handle everything :)
I'd like to resolve the multiple issues highlighted here.
1. If I understand correctly, any direct usage of new ErrorConditionException(...) will not work properly in code that has structured error handling. But it is not obvious how to leverage ProErro or SysError instances. Without this, I think our catch processing is not going to match the 4GL. The highest priority is in ErrorManager (5 locations) which is used everywhere for proper NO-ERROR support. But I think this affects all of FWD as well. There are 61 other places in FWD that directly construct ErrorConditionException. I think we should create factory methods for construction of the proper errors and then rework the code to use those everywhere.
2. I guess by using SysError.newInstance() we can match the session object chain behavior, but this won't work without modifications.
3. Our session object chain is pinned in memory todat but in the 4GL the chaining is equivalent to using a WeakReference in Java. The 4GL chained references can be garbage collected. I do wonder what that means for the object chain (does the 4GL automatically clean up the chain when something is GC'd or can you get an invalid object reference back). I'm guessing invalid references are possible.
Constantin: please post your thoughts.
I'd like to resolve this ASAP since it will manifest in many bad ways at runtime. Also, I'd like to get a clean and common approach retrofitted everywhere so that in can be consistent in all future work.
#7 Updated by Constantin Asofiei over 6 years ago
Greg Shah wrote:
1. If I understand correctly, any direct usage of
new ErrorConditionException(...)will not work properly in code that has structured error handling.
Yes, looks like these will need to be refactored.
But it is not obvious how to leverage
ProErroorSysErrorinstances.
I don't think the OE runtime ever throws ProError; I can't find any docs about this. The docs state that only SysError is thrown (and neither can be sub-classed or instantiated by application code).
Without this, I think our catch processing is not going to match the 4GL. The highest priority is in
ErrorManager(5 locations) which is used everywhere for properNO-ERRORsupport. But I think this affects all of FWD as well. There are 61 other places in FWD that directly constructErrorConditionException. I think we should create factory methods for construction of the proper errors and then rework the code to use those everywhere.
LegacyErrorException was meant to only be used via undoThrow or undoThrowTopLevel APIs. And the usage in LegacyEnum.getEnum doesn't have a compatible top-level block. This will pose problems, as the current runtime requires all LegacyErrorException usage to be from 4GL-compatible blocks, even if you force a throw new LegacyErrorException.
Note that when implementing the p2j.oo classes, we may need to mark them as ROUTINE-LEVEL UNDO, THROW or BLOCK-LEVEL UNDO, THROW (Marian already did this for some on which he is working). Otherwise, all the management for the OO-style ERROR conditions (like SysError) will not be able to be processed correctly by parent blocks.
2. I guess by using
SysError.newInstance()we can match the session object chain behavior, but this won't work without modifications.
I'm not sure I understand what is needed here - this creates a 4GL-compatible ObjectResource. We already do reference tracking and destroy objects once they are no longer referenced, as long as the instance is held in a ObjectVar. And automatically delete any instance which was never assigned in the first place (when the top-level block which created it finishes).
3. Our session object chain is pinned in memory todat but in the 4GL the chaining is equivalent to using a
WeakReferencein Java. The 4GL chained references can be garbage collected. I do wonder what that means for the object chain (does the 4GL automatically clean up the chain when something is GC'd or can you get an invalid object reference back). I'm guessing invalid references are possible.
We need tests for this. Something like 'create a new instance and save it in var A, check the chain, set var A to unknown, check the chain'. IIRC 4GL cleans after the reference pretty quickly.
But regardless, even if the chain would have invalid references, the application code can't do anything with them. At most it can do a valid-object test before accessing that instance.
#8 Updated by Greg Shah over 6 years ago
I want to avoid using undoThrow() everywhere in our runtime. This was designed to be used from within a BlockManager block context, not from the runtime. I prefer that we continue using EM..recordOrThrowError() etc... and hide the setup of things inside there.
#9 Updated by Constantin Asofiei over 6 years ago
Greg Shah wrote:
I want to avoid using
undoThrow()everywhere in our runtime. This was designed to be used from within aBlockManagerblock context, not from the runtime. I prefer that we continue usingEM..recordOrThrowError()etc... and hide the setup of things inside there.
I think at least BlockManager.mustManageLegacyError should be checked before throwing a LegacyErrorException. But ErrorManager.recordOrThrowError is aware of this. So if you add another dedicated API, use mustManageLegacyError.
pl.Contains- this is from PL/Java and must remain asthrow new ErrorConditionException, or some different approach, as we can't checkmustManageLegacyErrorin this 'headless' context.persist.TemporaryBufferusage I think is OK to remain as is (same asDmoAsmWorkerusage)p2j.uiusage I think can be switched safelyp2j.utilcan be switched, except:Agentwhich shouldthrow new ErrorConditionException, and theAppServerHelpershould decide what to do with thisSharedVariableManager.errorHelperhas a comment there- other notes in
CFO- I think at least some need to be changed torecordOrThrowError; currently the usage at least for parameter validation seems wrong, as ifNO-ERRORclause is set, the error message is not recorded.
#10 Updated by Greg Shah over 6 years ago
- % Done changed from 0 to 40
Task branch 4231b has been merged to trunk as revision 11347.
#11 Updated by Greg Shah about 6 years ago
- Related to Bug #4891: Nested method calls ignore 'silent' (no-error) option. added
#12 Updated by Greg Shah over 4 years ago
This work from #4352 needs to be worked here:
apperrorvssyserror- these weren't tested comprehensively, the support is pretty good, but when combined withROUTINE-LEVELorBLOCK-LEVELstatements, we may have missing issues (as I recall, we need to convert ERROR condition to SysError class).AppErroris used at least byRETURN ERRORstatements.We need to test and fix any deviations.
This will complete both
ON THROWandUNDO THROW.
#13 Updated by Greg Shah over 4 years ago
- Related to Feature #4352: finish progress.lang.apperror and progress.lang.syserror added
#14 Updated by Greg Shah over 2 years ago
- % Done changed from 40 to 80
#16 Updated by Greg Shah almost 2 years ago
Some things to ensure are fully working:
CATCHwith innerUNDO, THROWFINALLYwithDELETE OBJECT(without silent mode!)BLOCK/ROUTINE-LEVELused in combination withON ERROR UNDO, THROW.
#17 Updated by Constantin Asofiei almost 2 years ago
- File fin1prowin.7z added
- File finally_tests.zip added
- Assignee set to Eduard Soltan
Attached are automated generated tests covering FINALLY behavior. The fin1prowin.7z contains the logs of these tests when ran in 4GL.
There are also tests on the new testcases project, under tests/error_handling/. Please run these in FWD and check what it fails.
BLOCK/ROUTINE-LEVEL ON ERROR UNDO, THROW- optional- types of blocks:
REPEAT,DO,FOR, top-level (including OO methods) - ways to throw an OO exception:
RETURN ERROR { "value" | exception }UNDO, THROW exceptionnew apperrorwith and without a numeric value for the errorh:next-sibling(aka raising anERRORcondition)
- error raised from:
- inner block
- top-level block
- catch block
- and any combinations of the above
ON ENDKEY/ERROR/QUIT/STOPat one of the (grand)parent block on the stack, with theNEXT/RETRY/LEAVE/RETURN/THROWoptions.- zero or multiple
CATCHblocks on the stack - throwing exception from the
CATCHblock - transaction behavior - this I think needs to be handled separately, as FINALLY should be included, too.
#18 Updated by Marian Edu almost 2 years ago
Constantin Asofiei wrote:
Attached are automated generated tests covering
FINALLYbehavior. Thefin1prowin.7zcontains the logs of these tests when ran in 4GL.There are also tests on the new testcases project, under
This is a plan to generate tests for CATCH block, in a similar way it was done for FINALLY (and maybe expand this set, also). You can start with what was noted in #4602-16, and expand from that. An exhaustive set would cover all combinations of:tests/error_handling/. Please run these in FWD and check what it fails.
BLOCK/ROUTINE-LEVEL ON ERROR UNDO, THROW- optional- types of blocks:
REPEAT,DO,FOR, top-level (including OO methods)- ways to throw an OO exception:
RETURN ERROR { "value" | exception }UNDO, THROW exceptionnew apperrorwith and without a numeric value for the errorh:next-sibling(aka raising anERRORcondition)- error raised from:
- inner block
- top-level block
- catch block
- and any combinations of the above
ON ENDKEY/ERROR/QUIT/STOPat one of the (grand)parent block on the stack, with theNEXT/RETRY/LEAVE/RETURN/THROWoptions.- zero or multiple
CATCHblocks on the stack- throwing exception from the
CATCHblock- transaction behavior - this I think needs to be handled separately, as FINALLY should be included, too.
A lot of that is already included in tests/error_handling, also stop conditions tests are in tests/stop_handling. Of course this is probably not covering everything, finally block for instance was not tested and if I remember correctly the transaction mechanism was only tested against variables (undo vs. no-undo) - actual database transactions is to be covered under persistence. There is a lot of overlapping between various areas, we often end-up testing the same behaviour in many places and sometime is kind of hard to isolate a particular functionality in tests such as the tests won't fail because some other functionality used in those tests :(
Just to double check, is there anything that our team has to do with that "test suite" attached?
#19 Updated by Constantin Asofiei almost 2 years ago
Marian Edu wrote:
Just to double check, is there anything that our team has to do with that "test suite" attached?
Not at this time.
#20 Updated by Eduard Soltan over 1 year ago
I managed to setup the error handling test suite from tests/error_handling.
There were 66 tests failing out of 527.
Majority of problems came from non-existent support for undo, return error new Progress.Lang.AppError('test').
I added support for it, and committed on 4602a, rev. 15761.
#21 Updated by Eduard Soltan over 1 year ago
With this implemented only 17 tests are failing.
#22 Updated by Eduard Soltan over 1 year ago
Other problem that appears with tests from tests/error_handling seems to be a conversion issue:
In FWD the following statement throwMultipleAppError(?, input retValue) no-error. converts to silent(() -> FUNC_CALL_SITE_6.clone().execute(retValue));, with just one parameter.
#23 Updated by Eduard Soltan over 1 year ago
Also there is the following example:
def temp-table tt1
field f1 as char
field f2 as char.
def var h as handle.
create tt1.
tt1.f1 = "a1".
tt1.f2 = "a2".
release tt1.
create tt1.
tt1.f1 = "b1".
tt1.f2 = "b2".
release tt1.
for each tt1:
message tt1.f1.
stop.
catch ex as Progress.Lang.Stop:
message "Progress Catch STOP".
end.
end.
In 4GL the output will be the following:
a1 Progress Catch STOP b1 Progress Catch STOP
Meaning that after catching the STOP Error, the block continues to the NEXT iteration of the iterative block.
In progress on the other hand after the error is caught, the iterative block will be left complety.
a1 Progress Catch STOP
I mean this is expected since the execution of the CATCH and FINALLY blocks will be performed at the TransactionManager.popScope() level, after the iterative block is exited.
There is a task with the changes concerning this issue on #9004-71, and some changes are in 9004b.
#24 Updated by Eduard Soltan over 1 year ago
I made a bit more testscases, concerning the issue:
define variable h as handle.
for each book:
delete book.
end.
create book.
book.book-id = 1.
book.book-title = "Title1".
release book.
create book.
book.book-id = 2.
book.book-title = "Title2".
release book.
create book.
book.book-id = 3.
book.book-title = "Title3".
release book.
// WHEN AN ERROR IS THROWN, IT IS CAUGHT BY THE CATCH BLOCK AND THE FOR EACH BLOCK IS CONTINUES TO THE NEXT ITERATION.
for each book:
message book.book-id book.book-title.
h = h:next-sibling.
CATCH ex AS Progress.Lang.Error:
message "ERROR BLOCK" book.book-id book.book-title.
END CATCH.
end.
// SIMPLE REPEAT BLOCK, THAT SHOULD RUN INDEFINITELY.
// WHEN AN ERROR IS THROWN, IT IS CAUGHT BY THE CATCH BLOCK AND THE INFINITE REPEAT IS EXITED.
repeat:
h = h:next-sibling.
CATCH ex AS Progress.Lang.Error :
message "SINGLE REPEAT ERROR".
END CATCH.
end.
def var i as int.
// WHEN AN ERROR IS THROWN, IT IS CAUGHT BY THE CATCH BLOCK AND THE NON-INFINITE REPEAT CONTINUES TO THE NEXT ITERATION.
repeat i = 0 to 10:
h = h:next-sibling.
CATCH ex AS Progress.Lang.Error :
message "REPEAT ERROR " i.
END CATCH.
end.
One interesting thing here to note is the simple repeat case.
repeat:
h = h:next-sibling.
CATCH ex AS Progress.Lang.Error :
message "SINGLE REPEAT ERROR".
END CATCH.
end.
h = h:next-sibling. will thrown the error and it will be catched by the CATCH ex AS Progress.Lang.Error and the block will be exited.
#26 Updated by Eduard Soltan over 1 year ago
Error handling¶
Looking at 4gl documentation about CATCH blocks I have seen 2 things of interest.
The CATCH block is an undoable block with implicit ON ERROR UNDO, THROW error handling, and like all blocks, CATCH blocks implicitly throw all stop objects. You cannot explicitly override the implicit ON ERROR UNDO directive for a CATCH block. If a statement within the CATCH block raises ERROR and there is no nested CATCH block, the CATCH block will be undone, and the ERROR will be raised in the block that encloses the associated block of the CATCH block. Error is not raised in the associated block. Otherwise, infinite looping could occur. The same is true if the CATCH block raises STOP. Thus, a statement that raises ERROR or STOP within a CATCH block causes the following to occur: 1) UNDO the CATCH block. 2) Leave the CATCH block and its associated block. 3) THROW the error or stop object to the block enclosing its associated block. If the CATCH block is at the routine level, the error or stop object gets thrown to the caller of the routine.
In the following 4gl tests case, the error raised in CATCH block will be handled by l1 block on error directive or a catch block inside l1 block:
l1:
repeat transaction:
if l1_ran then do: k = k + 1. leave. end.
l1_ran = true.
l2:
repeat transaction i = 1 to 100:
k = k + 1.
h = h:next-sibling.
catch err as Progress.Lang.Error:
k = k + 1.
undo, throw new Progress.Lang.AppError().
end.
end.
k = k + 1.
leave.
end.
Flow-of-control directives¶
However what bothers be a lot is the following documentation info:
The code in any CATCH block can contain an explicit flow-of-control directive, meaning LEAVE, NEXT, RETRY, RETURN, or THROW. (RETRY and THROW require UNDO.) Since CATCH is an undoable block, LEAVE, NEXT, and RETRY without a label will apply to the CATCH block itself and not the associated block. If you want LEAVE, NEXT, or RETRY to apply to the associated block of a CATCH block, you must use the existing label syntax for these statements. An explicit UNDO, THROW in a CATCH block causes the AVM to raise ERROR or STOP in the block that encloses the associated block of the CATCH block; not the associated block itself.
Here it states that if I don't explicitly specify the block label it will apply to catch block itself. Which i could understand for leave, but for next and retry it is pretty weird.
I tested some combinations of flow-of-control directives in a catch block, and get the following documented the following results.
Note that associated block means the block with the defined catch block which has the flow-of-control directive. And grandparent block I call the parent of the associated block.
| STATEMENT | BEHAVIOUR |
|---|---|
| leave | Leaves the catch block and associated block. |
| next | Continues with the next iteration of the associated block. |
| retry | No immediate result, just disables infinite loop protection. |
| undo, leave | Undoes the catch block, and leaves the associate block. Execution continues with the code in grandparent block after associated block. |
| undo, next | Undoes the catch block, and leaves the associate block. Execution continues with the code in grandparent block after associated block. |
| undo, retry | Undoes the catch block, and leaves the associate block. Execution continues with the code in grandparent block after associated block. |
#27 Updated by Eduard Soltan over 1 year ago
More on control-of-flow directives¶
I looked at 4gl for leave, next and retry.
Leave:The name of the block you want to leave. If you do not name a block, the AVM leaves the innermost iterating block that contains the LEAVE statement. If there is no such block, then the AVM leaves the procedure block.
NEXT:The name of the block for which you want to start the next iteration. If you do not name a block, the AVM starts the next iteration of the innermost iterating block that contains the NEXT statement.
If I do not specify the label it will leave / next the most innermost iterating block. (could be even the associated block). So I guess there is no problem with it.
UNDO label1, [LEAVE [label2], NEXT [label2]] STATEMENT¶
Here things get a little more complicated. As the behaviour seems to differ in CATCH and in FINALLY. Lets consider the following example:
def var i as int.
def var j as int.
def var k as int.
l1:
repeat transaction i = 1 to 5:
l2:
repeat j = 1 to 5 on error undo, leave:
k = k + 1.
finally:
k = k + 1.
undo, leave.
end.
end.
k = k + 1.
leave.
end.
message k.
There is undo, leave. in a FINALLY block, which cause the changes to k made in FINALLY to be undone, and the program continue with execution of the next iteration of the l2 labeled block. Same goes with the execution of undo, next and undo, retry.
With the CATCH block it is a different story:
l1:
repeat transaction i = 1 to 5:
l2:
repeat j = 1 to 5 on error undo, leave:
k = k + 1.
undo, throw new Progress.Lang.AppError("HEY").
catch err as Progress.Lang.Error:
k = k + 1.
undo, leave.
end.
end.
k = k + 1.
leave.
end.
message k.
Either statements undo, leave, undo, next and undo, retry will undo the changes to k variable made in the catch, and leave the associated block. I am thinking that undo in a catch block will cause a leave in the associated block.
#28 Updated by Eduard Soltan over 1 year ago
I have generated a test suite with errors or control-of-flow condition being thrown in different blocks (do, repeat, for-each, function, procedures and methods).
For all the respecitve blocks, there are tests created that throws errors or uses control-of-flow from the catch blocks. Tests uses alternatively block-level on error undo, throw, routine-level on error undo, throw or none.
Statements used in the tests are next, leave, retry, undo, next, stop, quit, undo, leave, undo, retry, undo, throw new Progress.Lang.Error, return error, return new Progress.Lang.Error and h = h:next-sibiling.
Problems noticed:
1) undo, retry statment in repetive blocks like repeat_to, repeat_to_while, do_to, do_to_while, for_loop_to, for_loop_to_while will move the iteration to the next iteration of the block. With the current version of trunk it will leave the block.
2) there were a couple of issues with the errors and control-of-flow statments in catch blocks.
The code in any CATCH block can contain an explicit flow-of-control directive, meaning LEAVE, NEXT, RETRY, RETURN, or THROW. (RETRY and THROW require UNDO.) Since CATCH is an undoable block, LEAVE, NEXT, and RETRY without a label will apply to the CATCH block itself and not the associated block.
After different experiment I concluded the following things about control-of-flow stamtents in catch blocks:
leave with no label will leave the associated block.
next with no label will go to next iteration.
undo, leave, undo, next and undo, retry with no label at all will have the same effect: undo the chages made in catch block and leave the associated block. Note that it is totally different from these statments in catch blocks. In finally blocks it will go to the next iteration blocks.
undo, leave someLabel, undo, next someLabel and undo, retry someLabel with no label for undo: will undo the chages made in catch block and the subsequent action of the respective label.
undo, leave this statment in catch block will be converted to undoLeave("associated_block_label"). I think that it is not right, it should be converted to undoLeave("") in this way it will get the catch block from the stack and perform the corect action.
3) error throwing in catch blocks mostly works right with some exception.
Failing example found:
Throwing an error in a topLevel block when we have neither block-level un error undo, throw nor routine-level un error undo, throw set, will not propagate the error up to the caller. But when the smae error is thrown inside the catch block of the topLevel block, in this case the error will acually be propagate to the caller.
But I think this relates to a more deep problem with how we handle the error thrown in catch block. In processLegacyError we get the block from the top of the stack (which will be a catch block), and iterate till we get a block with a catch block which could handle the error type thrown. But there are cases when we could match the catch block that we are already in at that moment.
I think that when we detect that we are in a catch block, we should verify the stack starting with 2 levels down.
#29 Updated by Eduard Soltan over 1 year ago
The problem that I am facing right now. I have some tests with control-of-flow statement and error throwings directly from file procedures. I execute the those procedures with 2 input-output parameters which change the value depending of different scenarios. When the errror is being thrown and the control returns to the caller procedure, those variables does not update their values in FWD but in OE it doesn't. I don;t know whter this is a error handling issue, but this doesn't allow me to test automatically the correctness of the tests.
#30 Updated by Marian Edu over 1 year ago
Eduard Soltan wrote:
The problem that I am facing right now. I have some tests with control-of-flow statement and error throwings directly from file procedures. I execute the those procedures with 2 input-output parameters which change the value depending of different scenarios. When the errror is being thrown and the control returns to the caller procedure, those variables does not update their values in FWD but in OE it doesn't. I don;t know whter this is a error handling issue, but this doesn't allow me to test automatically the correctness of the tests.
Eduard, not sure what is the difference here - I assume in FWD the variables are updated (although you say it `does not`), in OE input-output/output parameters are updated only if there wasn't any error - well unless those parameters are passed by reference (memptr pointer, temp-table, dataset, any handle), otherwise when passed `by value` the value is only update if there wasn't any error.
#31 Updated by Eduard Soltan over 1 year ago
Marian Edu wrote:
Eduard, not sure what is the difference here - I assume in FWD the variables are updated (although you say it `does not`), in OE input-output/output parameters are updated only if there wasn't any error - well unless those parameters are passed by reference (memptr pointer, temp-table, dataset, any handle), otherwise when passed `by value` the value is only update if there wasn't any error.
Sorry I was more referring that I have problems with my tests. Indeed for errors being thrown in topLevel blocks (function, procedure, method) indeed the value of input-output parameter is not updated in the caller. However for statements like (QUIT, STOP, LEAVE, etc), these values in OE does update in the caller. But in FWD they does not.
#32 Updated by Eduard Soltan over 1 year ago
Managed to find and solve (hopefully) the problem input-output parameter updates in the caller with different flow-of-control directives.
1) LEAVE, NEXT and RETRY has no effect on the parameters, it will get updated in the caller. (No matter it comes from the main block or from catch/finally block).
2) Different error conditions, will never update the input-output parameter in caller, even if the error itself it will not get propagated to the the caller in case of default error handling behaviour.
3) QUIT will always update the parameters values in the caller. Weird part comes from STOP, if encountered in the main block it will not-update the parameters in the caller, however when encountered in the catch or finally it will.
Committed on 4602a the changes to match this behaviour.
#33 Updated by Constantin Asofiei over 1 year ago
Eduard, for now please commit the tests (the ones I sent and what you wrote) to old testcases project, testcases/uast/error_handling2 (a new folder). Will see how we can migrate these as unit tests.
#34 Updated by Eduard Soltan over 1 year ago
Committed the testcases to old testcases project under uast/error_handling2.
#35 Updated by Greg Shah over 1 year ago
1)
undo, retrystatment in repetive blocks likerepeat_to,repeat_to_while,do_to,do_to_while,for_loop_to,for_loop_to_whilewill move the iteration to the next iteration of the block. With the current version of trunk it will leave the block.
Please see rules/annotations/block_properties.rules where we have this note:
<!-- ON phrases and the UNDO statement can be specified with secondary
actions (RETRY, LEAVE, NEXT) which have no explicit target (label),
in such cases the target is always the same as the target of the
UNDO AND depending on the target block properties, the action may
be statically converted as in the following:
1. If the action is LEAVE or NEXT and the target block is a
top-level block, then the action will be converted to a RETURN.
2. If the action is NEXT and the target block is a non-iterating
inner block (it is not a top-level block), then the NEXT will
be converted to a LEAVE.
RETURN is an action that never references a label so it is
ignored in this processing.
RETRY will automatically be targetted to the same block as a
pending UNDO by the runtime, so it can be ignored here. This means
that we avoid emitting an extra string in the converted source
code, which is better.
-->
After different experiment I concluded the following things about control-of-flow stamtents in catch blocks:
leavewith no label will leave the associated block.
nextwith no label will go to next iteration.
undo, leave,undo, nextandundo, retrywith no label at all will have the same effect: undo the chages made in catch block and leave the associated block. Note that it is totally different from these statments in catch blocks. In finally blocks it will go to the next iteration blocks.
undo, leave someLabel,undo, next someLabelandundo, retry someLabelwith no label for undo: will undo the chages made in catch block and the subsequent action of the respective label.
undo, leavethis statment in catch block will be converted toundoLeave("associated_block_label"). I think that it is not right, it should be converted toundoLeave("")in this way it will get the catch block from the stack and perform the corect action.
Please review rules/annotations/block_properties.rules very carefully. There is a lot of logic in there to calculate the target block when a label is not provided. There is also logic to implicitly convert LEAVE to NEXT, and LEAVE/NEXT to RETURN in certain cases. I want to ensure anything we do here is consistent with our previous findings.
#36 Updated by Constantin Asofiei over 1 year ago
Eduard Soltan wrote:
Committed the testcases to old testcases project under
uast/error_handling2.
Please also commit the generator .java programs.
#37 Updated by Eduard Soltan over 1 year ago
Greg Shah wrote:
1)
undo, retrystatment in repetive blocks likerepeat_to,repeat_to_while,do_to,do_to_while,for_loop_to,for_loop_to_whilewill move the iteration to the next iteration of the block. With the current version of trunk it will leave the block.Please see
rules/annotations/block_properties.ruleswhere we have this note:[...]
After different experiment I concluded the following things about control-of-flow stamtents in catch blocks:
leavewith no label will leave the associated block.
nextwith no label will go to next iteration.
undo, leave,undo, nextandundo, retrywith no label at all will have the same effect: undo the chages made in catch block and leave the associated block. Note that it is totally different from these statments in catch blocks. In finally blocks it will go to the next iteration blocks.
undo, leave someLabel,undo, next someLabelandundo, retry someLabelwith no label for undo: will undo the chages made in catch block and the subsequent action of the respective label.
undo, leavethis statment in catch block will be converted toundoLeave("associated_block_label"). I think that it is not right, it should be converted toundoLeave("")in this way it will get the catch block from the stack and perform the corect action.Please review
rules/annotations/block_properties.rulesvery carefully. There is a lot of logic in there to calculate the target block when a label is not provided. There is also logic to implicitly convertLEAVEtoNEXT, andLEAVE/NEXTtoRETURNin certain cases. I want to ensure anything we do here is consistent with our previous findings.
Yes, I understand that.
Looking at progress documentation regarding catch blocks, there is a interesting part about flow-of-control statements.
The code in any CATCH block can contain an explicit flow-of-control directive, meaning LEAVE, NEXT, RETRY, RETURN, or THROW. (RETRY and THROW require UNDO.) Since CATCH is an undoable block, LEAVE, NEXT, and RETRY without a label will apply to the CATCH block itself and not the associated block. If you want LEAVE, NEXT, or RETRY to apply to the associated block of a CATCH block, you must use the existing label syntax for these statements. An explicit UNDO, THROW in a CATCH block causes the AVM to raise ERROR or STOP in the block that encloses the associated block of the CATCH block; not the associated block itself.
And by many experiments I performed with this statements, I can conclude some things:
1) simple statements like leave, next, retry in the body of the catch block have a similar effect on the associated block. leave will leave the associated block (iterative or non-iterative), NEXT it jumps to the next iteration of the iterative block.
2) operation like UNDO, LEAVE, UNDO, NEXT and UNDO, RETRY inside the catch block inside a (repetitive or non-repetitive) will do the same thing. Undo the changes done inside the catch block in case of a transaction, and leave the associated block.
Lets take the UNDO, NEXT as a example:
If this statement will be converted in the same way for both cases whether in the main body of the block or the catch block as undoNext("associated_block_label")..
For the first case, with the statement inside the main block this will match the 4GL behaviour, meaning that it will undo the changes in associated_block and go to the next iteration.
However for the second case with UNDO statement inside a CATCH, this will not match the behaviour of 4gl, since it should undo the changes in CATCH and LEAVE associated block.
If the UNDO statement will be present in the CATCH block of a topLevelBlock it is fine to be converted into undoReturnNormal("") in this way it will rollback the CATCH and return.
The logic from block_properties.rules is take into consideration, it just this case inside a CATCH block that should be treated differently. Passing empty string as a parameter to undoNext("") as a pramter will ensure that operations are performed on the block from the top of stack.
#38 Updated by Eduard Soltan over 1 year ago
Committed on UAST testcases project under uast/error_handling2/4GLTestsGenerator/ the Java sources used to generate 4gl tests cases.
#39 Updated by Eduard Soltan over 1 year ago
A little break down of the things performed on 4602a:
1) Added support for catch blocks in iteration blocks. Basically when the error is thrown in the block body and also catched and handled by the CATCH block of the repetive block, it should move to the next iteration of the block.
This is done by calling the executeBlockTermination(wa, blk, blk.possibleCatch, false); with blk.possibleCatch lamda as a parameter in TM.iterateWorker. TM.iterateWorker is called from TM.blockSetup, that is called before every execution of the processBody in BlockManager.
2) Support for catch blocks in iteration blocks introduces some overhead, since there are errors or flow-of-control statemnts (LEAVE, NEXT, RETRY) that could be thrown from CATCH block and they should be handled differently then the error handling of the processBody.
Examples:
- errors thrown from CATCH should be thrown directly to the next block and not handled.
- NEXT of the current block from the CATCH will skip a iteration, if the error is handled by the error handling logic of processBody.
That is why some error handling logic was introduce for the call of TM.blockSetup and TM.popScope.
3) Also there is a need for handling flow-of-control errors from popScope (when we have non-iterative blocks or the last iteration of an iterative block). In order to handle that we should have the access to the current block in TM.blocks. Which is not the case after execution of TM.popScope. That is why I move execution of FINALLY and CATCH blocks in a separate method.
4) to determine if ErrorConditionException in catch blocks should be handled as a LegacyError, we should start the lookup from the parent of the associated block. Otherwise we could match the same catch block we are at the moment when the error was thrown.
5) there is some input-output assignment logic modification in case of flow-of-control statements. See #4602-32
6) also a conversion change for UNDO, LEAVE, UNDO, NEXT and UNDO, RETRY inside catch blocks , basically it will convert these statements in undoLeave(""), undoNext("") to target the current block from the stack. Although this should suffer some modification once 9470a will reach trunk. And some runtime changes to address that in doTerminationBlockWorker.
#40 Updated by Eduard Soltan over 1 year ago
Committed on 4602a, rev. 15763. Added history entries and java docs.
#41 Updated by Eduard Soltan over 1 year ago
Also there is the following test case which is not handled in fwd:
define variable h as handle.
DEFINE VARIABLE myCustObj AS CLASS DataModelObject NO-UNDO.
def temp-table tt1
field f1 as int
field f2 as int
field f3 as int.
def var i as int.
def var j as int.
doLabel1:
do transaction:
repeat j = 1 to 4 on error undo, throw:
h = h:next-sibling.
end.
CATCH ex AS Progress.Lang.Error :
message "ERROR".
END CATCH.
end.
message "END".
Catch block of the doLabel1 should be handled.
#42 Updated by Greg Shah over 1 year ago
- reviewer Constantin Asofiei, Greg Shah added
#43 Updated by Eduard Soltan over 1 year ago
- Status changed from New to WIP
- reviewer deleted (
Constantin Asofiei, Greg Shah)
#44 Updated by Eduard Soltan over 1 year ago
- reviewer Constantin Asofiei, Greg Shah added
#47 Updated by Eduard Soltan over 1 year ago
- Related to Bug #9893: LegacyErrorException is not rethrown in processForBody/processBody added
#48 Updated by Eduard Soltan over 1 year ago
- Related to Bug #9910: Incorrect Error Handling for ROUTINE-LEVEL ON ERROR UNDO, THROW in FWD ABLUnit Tests added
#49 Updated by Eduard Soltan over 1 year ago
- Related to Bug #9969: Parsing query string error with \r character. added
#50 Updated by Eduard Soltan over 1 year ago
- Status changed from WIP to Review
- % Done changed from 80 to 100
I tested patch from #9969 with the changes from 4602a, on customer application unittests and I no longer see the regression in the module.
#51 Updated by Constantin Asofiei over 1 year ago
Eduard, please rebase 4602a.
#52 Updated by Eduard Soltan over 1 year ago
Rebased 4602a branch.
#53 Updated by Dănuț Filimon about 1 year ago
- Related to Bug #10599: [Regression] undoLeaveTopLevel() generated during conversion, but it doesn't exist added
#54 Updated by Ovidiu Maxiniuc about 1 year ago
- Related to Bug #10831: Incorrect handling of UNDO, RETURN ERROR <error> causes IllegalStateException to be thrown added
#55 Updated by Constantin Asofiei 10 months ago
Eduard, please rebase again.
#56 Updated by Eduard Soltan 10 months ago
Constantin Asofiei wrote:
Eduard, please rebase again.
I rebased to trunk. 16335.
I have noticed a bug:
start.p
output to start1.p. run start1.p. output close.
start1.p
output to start1.log.
def temp-table tt1 field f1 as int.
def var k as int.
def var h as handle.
create tt1.
tt1.f1 = 4.
release tt1.
for each tt1 :
k = k + 1.
h = h:next-sibling.
catch err as Progress.Lang.Error:
k = k + 1.
h = h:next-sibling.
end.
end.
output close.
When h = h:next-sibling error is thrown and propagated, start1.log is FileStream is closed. But the problem is that start.log stream is not restored. Solved the problem in rev. 16346.
#57 Updated by Eduard Soltan 10 months ago
I will rerun the generated tests, but for now I am facing a different issue (NPE when logging an error in a test file). Tried to create a small test case, but the problem appears only in generated tests (could be a config problem).
#58 Updated by Eduard Soltan 10 months ago
I have run the generated tests and the testcases/tests/error_handling test, and they still pass with the rebased version of 4602a.
#59 Updated by Eduard Soltan 10 months ago
- Related to Bug #10624: DO WHILE that contains a FINALLY block can be executed too many times added
#60 Updated by Constantin Asofiei 10 months ago
Eduard, please rebase the 4602a branch and add history entries, fix copyright years and javadocs as needed.
#61 Updated by Eduard Soltan 10 months ago
Rebased 4602a to trunk rev. 16401, and added javadocs and history entries.
#62 Updated by Eduard Soltan 8 months ago
Rebased 4602a to trunk rev. 16471.
#63 Updated by Constantin Asofiei 8 months ago
Eduard, please rebase again and lets do full testing (conversion/runtime) on it.
There are also some questions/issues bellow:TransactionManager.iterateWorkeris no longer usedToClause.decrement()- are you saying if an exception is thrown in a
catchorfinallyblock, then the iteration is retried with the same counter? Or is it when the block is exit via an exception from catch/finally, it ends with the previous counter value? - please make it
package-private
- are you saying if an exception is thrown in a
- javadoc missing
BlockManager.doTerminationBlockWorkerforparentLabelBlockManager.hasLegacyErrorforstartLevel; check also the line length in theforblockUnnamedStreams$WorkArea.temporaryEvictedOutfield
Thanks.
#64 Updated by Eduard Soltan 8 months ago
Constantin Asofiei wrote:
- TransactionManager.iterateWorker
ToClause.decrement()
- are you saying if an exception is thrown in a
catchorfinallyblock, then the iteration is retried with the same counter? Or is it when the block is exit via an exception from catch/finally, it ends with the previous counter value?- please make it
package-private
It is a leftover from on of the previous implementation of 4602a. In trunk the catch or finally block are executed from TM.blockSetup, which is executed after needsIterate where iterate variable is increased.
Since the catch or finally block execution was moved in TM.blockTermination, executed after the processBody method, it is no longer required.
#65 Updated by Eduard Soltan 7 months ago
I tested 4602a branch on regression test project and ETF tests. I managed to get all the tests passing, but had to make a few adjustment.
- commit/rollback of the changes made in the main block has to be executed during after each iteration. (4602a changes has all this logic moved from TM.iterateWorker and TM.popScope to TM.blockTermination). TM.blockTermination has the contains the commit/rollback logic and the termination block logic. So this method has to be executed even with blocks that don't have a termination block at all (GenericFrame.updateWorker, BlockManager.editingBlock).
- processFinalizables and some block flags changes moved from TM.blockTermination back to the next iteration setup.
- about the change in UnnamedStream.
The real problem in the following tests:
start.p
output to start1.p. run start1.p. output close.
start1.p
output to start1.log.
def temp-table tt1 field f1 as int.
def var k as int.
def var h as handle.
create tt1.
tt1.f1 = 4.
release tt1.
for each tt1 :
k = k + 1.
h = h:next-sibling.
catch err as Progress.Lang.Error:
k = k + 1.
h = h:next-sibling.
end.
end.
output close.
Now all the behaviour that I will describe is about trunk:
I start1.p I open up an output stream, and will register its closer on top level procedure return wa.pm.executeOnReturn. If the UnnamedStream is closed before the procedure finishes (UnnamedStream.closeOut() in converted code), it's closer is deregistered from executeOnReturn. Also the code UnnamedStream is registered as Scopeable.
The problem is that Runnable code registered for executeOnReturn is executed before the code scopeFinished of UnnamedStream. Which will definitely leads to invalid state of UnnamedStream.
I fixed this problem by bypassing the registration of closers to executeOnReturn, and execute the close logic from scopeFinished.
I rebased the branch have pushed all the changes to 4602a, rev. 16521. Could you please take a look, especially at UnnamedStream?
#66 Updated by Eduard Soltan 7 months ago
+ Constantin
#67 Updated by Eduard Soltan 6 months ago
Rebase 4602a to trunk rev. 16588.
#68 Updated by Eduard Soltan 5 months ago
Rebased 4602a to trunk rev. 16642. Please review.
#69 Updated by Alexandru Lungu about 2 months ago
Eduard Soltan wrote:
Rebased 4602a to trunk rev. 16642. Please review.
Constantin, given the extensive effort to fix OO 4GL and especially the error handling + the new development workflow that is AI assisted, do you think it is feasible to push 4602a over the finish line? I fear the rebase hell if this task branch lags behind + the several issues I find in a customer project and usually general testing due to incorrect error propagation.
We can start a feedback loop of AI assisted reviews to converge to a stable version and have an extensive testing effort to put this behind us.
#70 Updated by Alexandru Lungu about 2 months ago
PS: I would also like to have the findings on structured error handling here documented in a 'concept page' of KB, generate a private overlay, generate tests, document the tests and have this wrapped in a state of the art effort.
#71 Updated by Eduard Soltan about 2 months ago
Alexandru Lungu wrote:
We can start a feedback loop of AI assisted reviews to converge to a stable version and have an extensive testing effort to put this behind us.
I will start AI generated reviews and test generation.
#72 Updated by Constantin Asofiei about 2 months ago
Alex, I completely agree. Eduard, please rebase first (lets get the painful part aside).
#73 Updated by Greg Shah about 1 month ago
- Related to Feature #12007: implement Progress.Lang.SoapFaultError added
#74 Updated by Eduard Soltan 17 days ago
4602a: rebase on trunk 16828 and error-handling test suite¶
- 4602a: rebase on trunk 16828 and error-handling test suite
- Summary
- Rebase
- Test suite
- FWD 4602a results, layers 1 and 2
- FWD defects found
- 1. UNDO inside FINALLY is converted wrongly
- 2. NEXT inside FINALLY after an error leaves the loop
- 3. STOP inside FINALLY after an error raises STOP
- 4. A loop iterates again after its CATCH handled an error, and DO WHILE never ends
- 5. RETURN ERROR "msg" from an inner block, CATCH or FINALLY of the callee gives the wrong error object
- 6. NEXT or LEAVE in FINALLY after an error, at BLOCK-LEVEL, is reversed
- Issue-specific areas
- Open items
Summary¶
- Branch 4602a was rebased on trunk revision 16828. One compile fix is needed after the rebase and is not committed yet (see below).
- A self-checking 4GL test suite of 28,210 programs was built for the error-handling behaviour touched by #4602. It covers CATCH, FINALLY, UNDO/RETURN ERROR, ON phrases, NO-ERROR/ERROR-STATUS, error propagation, class errors and undo of data. It also has dedicated areas for #11255, #8944 and #5651.
- Every test was run on real OpenEdge 11.6. OpenEdge's results are the expected values: a test returns
passedonly if its trace equals the one OpenEdge produced. - Layers 1 and 2 (12,625 programs) were run on FWD 4602a. 6 distinct FWD defects were found, listed under "FWD defects found". Layer 3 (15,585 programs) is converted for FWD at the time of writing; its FWD results will follow in a separate note.
- The same tests have not been run on trunk yet, so it is not known which defects come from the 4602a changes and which already exist in trunk.
Rebase¶
- The branch forked from trunk at 16642 and had 17 revisions (16643-16659). They were replayed on trunk 16828 as 16829-16845.
- The file history headers were renumbered on top of trunk's entries. The duplicate history numbers in three files already exist in trunk.
- No conflict markers are left.
- Compile fix needed after the rebase, not committed: trunk added a call to the 3-argument
hasLegacyError. In 4602a that method takes 4 arguments, soBlockManager.javaneedshasLegacyError(wa, type, i, 0)at that call.
Test suite¶
How it works¶
- The tests are plain 4GL procedures, run in batch mode by a driver,
e4602/run_suite.p, from a list of programs (manifest.i). The driver writes one result line per program. - Each program records a trace of which statements ran and what values it saw:
- ERROR-STATUS and RETURN-VALUE;
- the caught error's class, message number, text, ReturnValue and Severity;
- which undoable and NO-UNDO variables and records survived.
- The OpenEdge trace is stored in the program as its expectation, so the program checks itself. Programs whose OpenEdge outcome is an uncaught error or STOP are checked by comparing the OpenEdge and FWD result lines.
- Layer-2 and layer-3 scenarios run at the 3 error levels: default,
BLOCK-LEVEL ON ERROR UNDO, THROWandROUTINE-LEVEL ON ERROR UNDO, THROW(#5651'sfinally_flowuses the first two). Most also vary the caller kind: internal procedure, external RUN, persistent procedure, function, method. - The tests are generated by Python scripts from scenario tables. The 4GL is not hand-written, so the suite can be regenerated after a change without losing the stored expectations.
Contents¶
| Layer | Area | Programs | What it covers |
|---|---|---|---|
| 1 | imported corpus (catch_tests, finally_tests) | 3,458 | Existing CATCH and FINALLY flow-of-control tests: NEXT, LEAVE, RETRY, UNDO, THROW, RETURN ERROR, STOP and QUIT, in REPEAT, FOR EACH, functions and procedures |
| 1 | new generated families | 7,268 | CATCH and FINALLY in DO and DO WHILE (TRANSACTION and ON ERROR UNDO, LEAVE), REPEAT with RETURN, and CATCH and FINALLY on the same block |
| 2 | undo_return | 126 | RETURN ERROR, RETURN ERROR "msg", RETURN ERROR NEW AppError, UNDO, RETURN ERROR, UNDO, THROW; what the caller sees |
| 2 | catch_iter, catch_iter_callers | 882 | CATCH in loops with 4 error sources (AppError, subclass, system error, RETURN ERROR from a callee), mismatched CATCH types, explicit ON ERROR |
| 2 | finally | 144 | FINALLY on DO, procedure, function and method bodies; order of nested FINALLY; RETURN and RETURN ERROR in FINALLY; STOP and QUIT |
| 2 | params | 144 | OUTPUT and INPUT-OUTPUT parameters (scalar, EXTENT, TABLE) when the callee ends with an error, LEAVE, NEXT or STOP |
| 2 | transactions | 90 | Record undo and commit together with CATCH and FINALLY, sub-transactions, NO-UNDO tables, UNDO, RETRY |
| 2 | streams | 45 | Unnamed, named and nested OUTPUT TO reset after an error, RETURN ERROR or STOP |
| 2 | call_chains | 180 | Error propagation through 3-deep call chains with all 9 caller/callee level pairs |
| 2 | catch_finally_tx | 288 | Record and transaction work done inside CATCH and FINALLY |
| 3 | on_phrase | 1,890 | ON ERROR, ENDKEY, STOP and QUIT phrases with every action, for 6 conditions and 5 block types |
| 3 | no_error | 1,845 | 26 statements that raise errors, under NO-ERROR, ERROR-STATUS reset or keep, CATCH by class, ON ERROR, and the defaults |
| 3 | classes | 1,215 | Errors in constructors, destructors, properties, static and overridden methods, DYNAMIC-NEW and DYNAMIC-INVOKE; the error object API |
| 3 | propagation | 1,809 | 12 call mechanisms (RUN VALUE, super procedures, function IN h and IN SUPER, DYNAMIC-FUNCTION, PUBLISH, methods, constructors, properties) by 6 error sources by 9 level pairs |
| 3 | undo_vars | 1,080 | What UNDO restores for 9 kinds of data by 10 undo triggers by 4 places the change was made |
| 3 | nested | 1,200 | Three nested blocks with every ON ERROR phrase combination |
| 3 | return_values | 1,365 | RETURN-VALUE and ERROR-STATUS for 13 RETURN forms, including whether a later RUN resets them |
| 3 | silent_nesting (#11255) | 1,125 | NO-ERROR call whose callee's error passes through a FINALLY or CATCH that runs its own NO-ERROR statement |
| 3 | finally_tx (#8944) | 1,140 | Record work in CATCH and FINALLY of FOR EACH EXCLUSIVE-LOCK and REPEAT TRANSACTION, with and without an outer transaction |
| 3 | finally_flow (#5651) | 2,916 | Statement in the loop body against statement in FINALLY (14 forms, including nested FINALLY), with the caller shapes from #5651 |
| Total | 28,210 |
Running it¶
The suite lives in a disposable greenfield project inside the branch working tree, not versioned:
.tmp/greenfield/abl/e4602/: tests, grouped by layer and area.tmp/e4602/: generators, runner scripts, results and progress ledger
One command runs everything, or a subset:
.tmp/e4602/run_all_4602.sh [fwdcmp|oe|both|cmp] [--convert] [--only <regex>] fwdcmp run on FWD and compare with the stored OpenEdge results (default) oe run on OpenEdge (refreshes the OpenEdge results) both OpenEdge, then FWD, then compare cmp compare the stored results only --only e.g. --only '^l3_' or --only 'catch_do$'
It prints one line per area with the number of differences. The details are in .tmp/e4602/results/<area>.compare.txt.
Limits¶
- OpenEdge version: the reference VM runs OpenEdge 11.6.
- #5651 states that 11.6.3 and 11.7+ differ for STOP raised in FINALLY. The expectations for those cases are 11.6 behaviour.
-catchStopandProgress.Lang.Stopdo not exist in 11.6, so they are not tested.- In 11.6 the TRANSACTION function returns
nofor work that only touches temp-tables.
- No database: the OpenEdge VM has no database for the project. Transaction tests use undoable and NO-UNDO temp-tables, so #8944's database-table cases (transaction numbers, WRITE triggers) are only approximated.
- Not batch-testable: UPDATE field rollback needs keyboard input and is not covered.
- Skipped corpus family: catch_routine contains only callee programs (their callers are missing). call_chains covers the same behaviour.
FWD 4602a results, layers 1 and 2¶
| Family or area | Programs | Differences from OpenEdge |
|---|---|---|
| corpus catch_do | 968 | 8 |
| corpus catch_dowhile | 968 | 968 (hang, defect 4) |
| corpus catch_finally | 2,904 | 1,261 |
| corpus catch_foreach, catch_function, catch_procedure, catch_procedure_repeat, catch_repeat, catch_repeat_ret | 1,871 | 0 |
| corpus finally_do | 968 | 404 |
| corpus finally_dowhile | 968 | 365 |
| corpus finally_ext | 1,014 | 275 |
| corpus finally_repeat | 819 | 293 |
| corpus finally_repeat_ret | 246 | 84 |
| l2 finally | 144 | 36 |
| l2 call_chains | 180 | 18 |
| l2 catch_iter | 672 | 91 |
| l2 catch_iter_callers | 210 | 0 |
| l2 params | 144 | 5 |
| l2 streams | 45 | 0 |
| l2 transactions | 90 | 0 |
| l2 undo_return | 126 | 18 |
| l2 catch_finally_tx | 288 | 35 |
The differences are not yet all classified. The catch_finally and FINALLY family counts include the programs that do not convert (defect 1).
FWD defects found¶
1. UNDO inside FINALLY is converted wrongly¶
UNDO, LEAVE <label>andUNDO, NEXT <label>inside FINALLY convert toundoLeaveTopLevel(String)andundoNextTopLevel(String). BlockManager has neither method, so the generated Java does not compile.- 582 test programs do not convert because of this: 130 corpus programs and 452 in the new families. They are listed in
.tmp/e4602/out/fwd_convert_failures.txt. - An unlabelled
UNDO, LEAVE,UNDO, NEXTorUNDO, RETRYinside FINALLY converts toundoReturnNormalTopLevel(), which returns from the whole procedure. OpenEdge only ends the FINALLY: in_undo_leave_0.p, OpenEdge runs all 100 iterations. - Probable cause:
rules/convert/control_flow.rulesappends "TopLevel" when the UNDO has no label of its own andtop_level_targetis set.rules/annotations/block_properties.rulessetstop_level_target = !createLabel(...).- The 4602a change to
createLabel(history entry 045) adds labels to CATCH blocks only, not to FINALLY blocks.
2. NEXT inside FINALLY after an error leaves the loop¶
Under ON ERROR UNDO, LEAVE, NEXT in FINALLY after an error: OpenEdge continues with the next iteration, FWD leaves the loop (error_next_1.p: FWD gives k=5:i=1).
3. STOP inside FINALLY after an error raises STOP¶
OpenEdge completes normally, FWD raises STOP (error_stop_0.p).
4. A loop iterates again after its CATCH handled an error, and DO WHILE never ends¶
l2: do while i <= 100 TRANSACTION:
i = i + 1. k = k + 1.
h = h:next-sibling. /* error */
catch ex as Progress.Lang.Error:
k = k + 1.
end.
end.
- OpenEdge: the error undoes the iteration (
iback to 1), the CATCH runs, and the loop is left. Result:i=1 k=4. - FWD: after the CATCH it runs the loop again. The error repeats and the undo resets
ieach time, soWHILE i <= 100never becomes false.- With a guard added, FWD ran the body 301 times and the CATCH 300 times, and
istayed 1. - The whole
catch_dowhilecorpus family hit the one-hour timeout.
- With a guard added, FWD ran the body 301 times and the CATCH 300 times, and
- The same bug shows without the hang:
- in
DO i = 1 TO 100loops: the 8 catch_do differences, where FWD ends withi=101; - in the
catch_finally_txDO WHILE cases, where the loop variable is not undone.
- in
- Suspect code, not confirmed: the branch adds a
blk.possibleCatchcheck inBlockManager.coreLoop(around lines 11873 and 12566). There, a LEAVE on a block that has a CATCH only ends the retry loop and the iteration goes on. Trunk's BlockManager has nopossibleCatch. - Reproducer:
.tmp/greenfield/abl/e4602/hang/v6.p.
5. RETURN ERROR "msg" from an inner block, CATCH or FINALLY of the callee gives the wrong error object¶
Applies to RETURN ERROR "msg" raised from a nested block, from a CATCH or from a FINALLY of the called procedure (l2/undo_return scenarios 7, 8 and 9):
- OpenEdge: the caller catches a
Progress.Lang.AppError(message number 0, ReturnValuemsg). - FWD: the caller catches a plain
Progress.Lang.Errorwith message number -1. RETURN-VALUE is correct.
6. NEXT or LEAVE in FINALLY after an error, at BLOCK-LEVEL, is reversed¶
Applies to NEXT l2 and LEAVE l2 in the FINALLY of a loop, after an error in the body, at BLOCK-LEVEL (l2/catch_finally_tx, scenarios tg03 and tg04):
- OpenEdge:
NEXToverrides the error and the loop continues;LEAVEdoes not, and the error reaches the caller. - FWD: the opposite: NEXT lets the error out, and LEAVE swallows it.
Issue-specific areas¶
- #11255: OpenEdge behaves as the issue describes. The FINALLY's NO-ERROR statement sees only its own error (565), and the caller of the NO-ERROR call sees only the original error (7351). The 1,125
silent_nestingtests vary the error source, what the FINALLY or CATCH does, where the FINALLY sits, and the call type. - #8944: the scenarios from the issue (DELETE or CREATE in FINALLY of FOR EACH EXCLUSIVE-LOCK, buffer defined inside FOR EACH and used in FINALLY, FINALLY inside an outer transaction) are covered with temp-tables. See the database limit above.
- #5651: the body-against-FINALLY matrix from the issue is covered in full, plus RETURN forms and nested FINALLY. The STOP-in-FINALLY cases are 11.6 behaviour (see Limits).
Open items¶
- Run layer 3 on FWD 4602a; report and classify the differences.
- Run the whole suite on trunk 16828, to separate defects caused by 4602a from ones that already exist in trunk.
- Decide on the uncommitted
BlockManager.javacompile fix from the rebase. - Fix defect 4 and the FINALLY UNDO conversion (defect 1). Both block parts of the suite: the endless loop, and 582 programs that do not convert.
#75 Updated by Eduard Soltan 10 days ago
During working on test suite, I encoutered several differences between OE version 11.6 vs 12.8:
1. STOP and QUIT with FINALLY:
- STOP: 11.6 skips FINALLY when a STOP passes through a block. 12.8 runs FINALLY once, then the STOP goes on.
- What a FINALLY can do to a pending STOP on 12.8:
- a QUIT in it replaces the STOP;
- a RETURN ERROR or a raised error replaces the STOP when a CATCH handles that error;
- a NEXT to the loop cancels a STOP raised in a CATCH, but not one raised in the body;
- LEAVE, UNDO/LEAVE, RETRY, RETURN and STOP don't cancel it.
- STOP and an error together: the caller gets only the STOP and the error is lost. 11.6 delivered the error later.
- UNDO, THROW in a FINALLY: it replaces a pending RETURN ERROR, so the routine doesn't return and the error goes to the enclosing block.
- QUIT: still skips FINALLY, as in 11.6.
2. Errors inside a WHERE expression: 12.8 raises the error itself (e.g. 76 for integer("x")). 11.6 swallowed it and reported the FIND failure (565) or returned no rows.
I am not sure what behaviour I should replicate?
#76 Updated by Eduard Soltan 10 days ago
Committed on 4369a, rev. 16853.
Branch 4602a changes the FWD runtime (and a few conversion rules) so that CATCH/FINALLY, STOP/QUIT, RETURN ERROR, STOP-AFTER and errors in WHERE clauses behave as in OpenEdge 12.8.
The changes were checked with a suite of 29,265 self-checking 4GL programs, each run on OpenEdge 11.6, OpenEdge 12.8 and FWD. FWD now gives the OpenEdge 12.8 result for 29,241 (99.92%). Where a rule was not clear from the suite, small probes were run on 12.8 to establish it.
Block flow (CATCH and FINALLY)¶
- Flow statements of a FINALLY block (LEAVE, NEXT, RETRY, RETURN, UNDO) do not end a pending STOP, error object or RETURN ERROR. An UNDO without a label in a FINALLY block ends only the FINALLY block.
- A loop which does not advance by itself (DO WHILE, REPEAT, REPEAT WHILE) is left after one of its CATCH blocks handled an error (infinite loop protection). An input statement disables the protection for the iteration.
- An error which a NEXT of the FINALLY block does not end is raised when the first statement of the next iteration ends, or when the loop ends. The conversion emits a statement end hook (
BlockManager.statementEnd()) in loops which have a FINALLY block. - An error object thrown by the FINALLY block (UNDO, THROW) replaces a pending RETURN ERROR: the routine does not return, the error is raised in the enclosing block.
- After a normal iteration of a FOR block, the record of its buffers is not available to field references in the FINALLY block (conversion hint
BlockManager.finallyRecordUnavailable()).
RETURN ERROR¶
- RETURN ERROR raises an error object when the caller has a matching CATCH block, also from a nested block, a CATCH or a FINALLY block of the routine.
- RETURN ERROR of a method which returns a value raises the error in the caller and sets RETURN-VALUE; RETURN ERROR in a property getter keeps its error object (conversion).
- RETURN ERROR in a database session trigger, or an error object which reaches its top-level block in default mode, makes the trigger fail: the statement which fired it raises ERROR.
- The FINALLY block run after a RETURN ERROR sees the caller's ERROR-STATUS as it was before the call.
STOP and QUIT¶
- The FINALLY block runs when a STOP passes through its block, and is skipped on QUIT (OpenEdge 11.7 and later).
- A QUIT raised in a FINALLY block replaces a pending STOP. A STOP or QUIT and an error which leave a block together are handled by the first CATCH block for the error or ON STOP / ON QUIT phrase met on the way out.
- When a counted loop (DO or REPEAT with TO) handles such a STOP with NEXT, the QUIT is raised when the first statement of the next iteration ends (also a statement of a called routine), and is handled by the loop like any QUIT; if no iteration is left, it is raised in the enclosing block.
- RUN of a program which is not found raises STOP carrying a
Progress.Lang.StopError(error 293), which a CATCH block reached before an ON STOP phrase handles, also under NO-ERROR. - STOP and QUIT leave the code after their block reachable, like UNDO, THROW (conversion).
STOP-AFTER¶
- An ON STOP phrase of a block nested in a STOP-AFTER block handles the STOP of the time-out.
- A time-out handled outside its STOP-AFTER block (by a CATCH block or an ON STOP phrase of an enclosing block or a caller) releases the timer when the block ends; before, the next STOP-AFTER never fired and the session could hang.
Errors in a WHERE clause¶
- An error raised by a built-in function while the WHERE clause is evaluated (for example
INTEGER("x"), error 76) is raised by the statement: FIND, FOR EACH, OPEN QUERY, FOR FIRST, and QUERY-OPEN of a dynamic query. With NO-ERROR the error is recorded in ERROR-STATUS and the statement ends (no "FIND FIRST/LAST failed" error). FWD, like OpenEdge 11.6, used to ignore the error and compare with the unknown value. - CAN-FIND raises nothing: the result is
no, and the message is recorded in ERROR-STATUS without the ERROR flag. - An error thrown by a user-defined function in a WHERE clause is still ignored (the term is unknown), as in both OpenEdge versions.
- An error of an expression which the database evaluates on each record (for example
INTEGER(field)on a record holding "x") raises STOP carrying aProgress.Lang.StopErrorat that record: the records before it are read, a CATCH block handles it, NO-ERROR does not suppress it. Before, FIND raised a plain STOP and FOR EACH, OPEN QUERY and dynamic queries ended as if there were no more records. - A 4GL condition raised while a dynamic query is evaluated goes on as such, instead of error 223 or an abnormal end of the session.
Errors and messages¶
- An error raised while the argument of a call (RUN, method, function) is evaluated gets the additional error 984, as in the 4GL (new conversion rule
call_arguments.rules). - Warning-type errors raise ERROR only when a CATCH block or an UNDO, THROW action applies: a value which does not fit its display format, an invalid CAST, a failing FIND method, error 7328 of a dynamic query. Error 74 of STRING is raised once its statement completed.
INTEGER()of a value too large for INTEGER reports warning 15747 (no**prefix) and returns the unknown value; an assignment which does not fit raises 15747 followed by 142.- A unique index violated by a field assignment raises error 132 alone.
- An error object handled by an ON ERROR phrase is displayed; in batch mode with redirected output a message is written as one line.
Transactions and objects¶
TRANSACTIONisnowhile a CATCH or FINALLY block of a transaction block runs.- A record changed in a CATCH or FINALLY block is not undone by a later iteration's undo.
- An OUTPUT TABLE parameter is not copied back when the routine ends with an ERROR or STOP condition.
- When a constructor fails, only the destructors of the classes whose constructor completed run.
Effect on converted applications¶
- A full reconversion is required: the statement end hook, the FINALLY buffer hint, error 984 for call arguments and the reachability of code after STOP/QUIT are conversion changes.
- A WHERE expression which fails no longer silently finds nothing: it raises an error, or a STOP for an expression evaluated on each record.
- The STOP object behaviour of OpenEdge 12 (a STOP or STOP-AFTER caught as an object by a CATCH block of a caller) needs the directory setting
catch-stop= 1 (server/standard/runtime/default/catch-stop). The FWD default stays 0, which is the OpenEdge 11.7 default; OpenEdge 12 always behaves as 1.
Remaining differences¶
Of the 29,265 programs, 24 still give a different result than OpenEdge 12.8:
| Programs | Cause |
|---|---|
| 17 | OpenEdge adds "Line N in <routine> <program>" to the overflow warning 15747. FWD has no 4GL line numbers at runtime; it would need a Java-to-4GL line map written by the conversion (the same map would give 4GL line numbers to CallStack / ERROR-STACK-TRACE, which now show Java lines). |
| 7 | STOP-AFTER time-out in a plain REPEAT loop: OpenEdge 12.8 gives different results for the same program from run to run (timing). FWD always gives the result 12.8 gives in most runs and in every deterministic case. |
#77 Updated by Eduard Soltan 10 days ago
Error-handling test suite for branch 4602a¶
The changes of branch 4602a were developed and checked against a suite of 29,265 self-checking 4GL programs. Each program was run on OpenEdge 11.6, on OpenEdge 12.8 and on FWD; OpenEdge 12.8 is the reference.
What it covers¶
CATCH and FINALLY, UNDO and RETURN ERROR, ON ERROR / ENDKEY / STOP / QUIT phrases, NO-ERROR and ERROR-STATUS, error propagation through every call mechanism, errors in classes (constructors, destructors, properties, methods), undo of variables and records, database errors and session triggers, errors in WHERE clauses and queries, the text of error messages, STOP and QUIT, and the OpenEdge 12 stop objects (Progress.Lang.Stop, StopError, StopAfter).
How a test works¶
- Every test is a plain 4GL procedure which runs one scenario and records a trace: which statements ran, ERROR-STATUS and RETURN-VALUE, the class, message number, text, ReturnValue and Severity of a caught error, which undoable and NO-UNDO variables and records kept their changes, and, for the message tests, the error messages written to the output.
- The trace OpenEdge produced is stored in the program as its expected value, so the program checks itself and returns
passedorfailed:<trace>. When the outcome is an uncaught error, STOP or QUIT, the result lines of the runs are compared instead. - A driver procedure runs a list of programs (one manifest per area) in batch mode and writes one result line per program. The same programs run unchanged on OpenEdge and, converted, on FWD.
- The scenarios of layers 2 to 4 run at the three error levels: default,
BLOCK-LEVEL ON ERROR UNDO, THROWandROUTINE-LEVEL ON ERROR UNDO, THROW. Most of them also vary the caller: internal procedure, RUN of an external procedure, persistent procedure, user-defined function, method. - The programs are generated from scenario tables by scripts, so the suite can be regenerated or extended without losing the stored expectations.
Layers¶
| Layer | Area | Programs | What it covers |
|---|---|---|---|
| 1 | CATCH families (9) | 6,711 | CATCH flow of control in DO, DO WHILE, REPEAT, FOR EACH, functions and procedures, and CATCH with FINALLY: NEXT, LEAVE, RETRY, UNDO, THROW, RETURN ERROR, STOP, QUIT |
| 1 | FINALLY families (5) | 4,015 | FINALLY flow of control in DO, DO WHILE, REPEAT, external procedures and REPEAT with RETURN |
| 2 | RETURN ERROR and UNDO | 126 | RETURN ERROR with and without a message or error object, UNDO, RETURN ERROR, UNDO, THROW: what the caller sees |
| 2 | CATCH in loops | 882 | CATCH in loops with 4 error sources, mismatched CATCH types, explicit ON ERROR, different callers |
| 2 | FINALLY | 144 | FINALLY of DO blocks, procedures, functions and methods; nested FINALLY; RETURN and RETURN ERROR in FINALLY; STOP and QUIT |
| 2 | parameters | 144 | OUTPUT and INPUT-OUTPUT parameters (scalar, EXTENT, TABLE) when the callee ends with an error, LEAVE, NEXT or STOP |
| 2 | transactions | 90 | Record undo and commit with CATCH and FINALLY, sub-transactions, NO-UNDO tables, UNDO, RETRY |
| 2 | streams | 45 | OUTPUT TO after an error, RETURN ERROR or STOP |
| 2 | call chains | 180 | Error propagation through 3-deep call chains, all combinations of caller and callee error level |
| 2 | transactions in handlers | 288 | Record and transaction work inside CATCH and FINALLY |
| 3 | ON phrases | 1,890 | ON ERROR, ENDKEY, STOP and QUIT with every action, for 6 conditions and 5 block types |
| 3 | NO-ERROR | 1,845 | 26 statements which raise errors, under NO-ERROR, CATCH by class, ON ERROR and the defaults |
| 3 | classes | 1,237 | Errors in constructors, destructors, properties, static and overridden methods, DYNAMIC-NEW, DYNAMIC-INVOKE; which destructors run when a constructor fails; the error object API |
| 3 | propagation | 1,809 | 12 call mechanisms (RUN VALUE, super procedures, IN handle, IN SUPER, DYNAMIC-FUNCTION, PUBLISH, methods, constructors, properties) by 6 error sources by 9 combinations of error levels |
| 3 | undo | 1,080 | What UNDO restores, for 9 kinds of data, 10 undo triggers and 4 places of change |
| 3 | nesting | 1,200 | Three nested blocks with every combination of ON ERROR phrases |
| 3 | return values | 1,365 | RETURN-VALUE and ERROR-STATUS for 13 forms of RETURN |
| 3 | silent nesting (#11255) | 1,125 | A NO-ERROR call whose callee's error passes a CATCH or FINALLY block which runs its own NO-ERROR statement |
| 3 | FINALLY and transactions (#8944) | 1,140 | Record work in CATCH and FINALLY of FOR EACH and REPEAT TRANSACTION |
| 3 | FINALLY flow (#5651) | 2,916 | A statement in the loop body against a statement in FINALLY (14 forms, nested FINALLY), with the caller shapes of #5651 |
| 3 | statement-level raise | 40 | When an error kept pending by a NEXT in FINALLY is raised in the next iteration |
| 4 | error sources | 291 | The core scenarios with other error sources: duplicate key, record not found, ambiguous FIND, BUFFER-COPY, session triggers (WRITE, CREATE, DELETE, ASSIGN), WHERE and query errors, QUERY-PREPARE, conversions, overflow, subscripts, ENTRY, invalid handles |
| 4 | re-throw | 318 | UNDO, THROW of a saved error object from CATCH and FINALLY, nesting, errors in destructors |
| 4 | properties | 96 | Errors in property getters and setters, errors in destructors |
| 4 | messages | 153 | The message text written to the output for displayed, silent and caught errors |
| 4 | stop objects | 135 | Progress.Lang.Stop (STOP statement), StopError (RUN of a missing program), StopAfter (STOP-AFTER); OpenEdge 12 only |
| Total | 29,265 |
Layer 1 started from an existing corpus of CATCH and FINALLY tests (3,458 programs), extended with generated families. Layers 2 to 4 were written for this work.
Runs¶
- OpenEdge 11.6: every program, in batch mode; these traces are the expected values stored in the programs.
- OpenEdge 12.8: every program, in one batch session from a self-contained package (the driver creates and loads the database it needs). 12.8 gives a different result than 11.6 for 945 programs, mostly the 12.8 handling of STOP and QUIT together with FINALLY (776); the rest are other rule changes (RUN of a missing program raises a StopError, ERROR-STATUS after PUBLISH, errors in WHERE clauses).
- FWD: every program converted and run in batch mode; a program counts as different when its FWD result is not the 12.8 result.
- Where the suite did not settle a rule, small probes were written and run on 12.8: STOP and QUIT raised in a FINALLY block of a loop iteration, errors in WHERE clauses (27 programs), STOP-AFTER time-outs repeated several times (to tell timing from rules).
Results¶
| Programs | FWD = 12.8 | |
|---|---|---|
| Layers 1-3 | 28,272 | 28,272 (100%) |
| Layer 4 | 993 | 969 (97.6%) |
| Total | 29,265 | 29,241 (99.92%) |
When the work started, FWD failed 6,408 programs. The 24 differences left:
- 17: OpenEdge adds "Line N in <routine> <program>" to the overflow warning 15747; FWD has no 4GL line numbers at runtime.
- 7: STOP-AFTER time-out in a plain REPEAT loop, where OpenEdge 12.8 gives different results for the same program from run to run (timing); FWD gives the result 12.8 gives in most runs.
#78 Updated by Eduard Soltan 10 days ago
I have update the documentation with the findings in documentation: https://proj.goldencode.com/projects/p2j/wiki/Chapter_15_Control_Flow.
#79 Updated by Constantin Asofiei 10 days ago
Eduard, good work on extending the tests. Did you check also -catchStop 1?
#80 Updated by Eduard Soltan 10 days ago
Constantin Asofiei wrote:
Eduard, good work on extending the tests. Did you check also
-catchStop 1?
I tested on OE 12.8 which has -catchStop 1 by default.
#81 Updated by Constantin Asofiei 10 days ago
Eduard Soltan wrote:
Constantin Asofiei wrote:
Eduard, good work on extending the tests. Did you check also
-catchStop 1?I tested on OE 12.8 which has
-catchStop 1by default.
And in FWD did you run with both 1 and 0 values? 12.8 allows disabling this.
#82 Updated by Eduard Soltan 7 days ago
Constantin Asofiei wrote:
And in FWD did you run with both 1 and 0 values? 12.8 allows disabling this.
Found some differences between OE with -catchStop 0.
- CATCH and FINALLY: FINALLY runs on STOP and is skipped on QUIT. Flow statements of a FINALLY (LEAVE, NEXT, UNDO) are honoured and do not drop a pending STOP, error object or RETURN ERROR. An unlabeled LEAVE in a CATCH or FINALLY leaves the nearest iterating block. An error raised in a CATCH or FINALLY reaches the caller's CATCH. TRANSACTION is false in CATCH and FINALLY.
- STOP and QUIT: a STOP is raised as a stop object (
Progress.Lang.Stop,StopErrorfor RUN of a missing program,StopAfter). STOP-AFTER time-outs are handled by nested ON STOP phrases and CATCH blocks as in 12.8. - catch-stop parameter: honoured, default 1 (OpenEdge 12). With 0 (as
-catchStop 0) no stop object reaches a CATCH and a pending STOP skips FINALLY blocks. - RETURN ERROR: raises an error object when the caller has a matching CATCH, also from methods, property getters and database triggers. An invalid object in ON ERROR UNDO, RETURN ERROR gives error 14117.
- Errors raised after the statement: errors such as STRING error 74 are raised when the statement completes. Errors of built-in functions in WHERE clauses are raised by the statement, and NO-ERROR records them. Warning-type errors raise ERROR only when a CATCH or UNDO, THROW applies.
- Records and objects: the FIND methods report a flush error of the buffer as 12.8 does. Records changed in a handler are not undone later. An OUTPUT TABLE is not copied back when the routine ends with ERROR or STOP. Only destructors of classes whose constructor completed run.
Committed on 4602a, rev. 16854.
#84 Updated by Eduard Soltan 7 days ago
Greg Shah wrote:
The setting should be defined based on the
EnvironmentOps"Progress" version which is currently 11.6.3 by default. Read the version and set the value accordingly.
There are some cases of error handling (not necessarily related to catchStop) where the OE differs in behaviour between 12.8 and 11.6, which one we should emulate? Or should we have different behaviour based on versions?
Ex.
| Behaviour | 11.6 | 12.8 |
|---|---|---|
Error of a built-in function in a WHERE clause (e.g. INTEGER("x"), error 76) |
Ignored, no error raised | The statement raises the error; NO-ERROR records it; a CATCH gets a SysError |
RETURN ERROR (in the body or a CATCH), then UNDO, THROW in the FINALLY |
The caller gets the error | Both errors are dropped; the routine or loop ends normally |
| An error raised in a FINALLY whose own nested FINALLY does NEXT | The error ends the loop after the first iteration | The NEXT wins; the loop runs all iterations and the error is dropped |
| STOP raised inside a CATCH block | The FINALLY is skipped | The FINALLY runs, also with -catchStop 0 |
| STOP in a nested FINALLY of a FINALLY | The loop ends | The loop goes on |
#86 Updated by Eduard Soltan 6 days ago
Committed on 4602a, rev. 16855.
- catch-stop: when the directory value is not set, it is 1 for version 12 and later, else 0.
- Errors of built-in functions in a WHERE clause (e.g. INTEGER): raised by the statement for version 12 (NO-ERROR records them, a CATCH gets a SysError); eaten for older versions, the term is the unknown value and the query runs.
- UNDO, THROW in a FINALLY block while a RETURN ERROR is pending: replaces the RETURN ERROR for version 12; for older versions only with ROUTINE-LEVEL or BLOCK-LEVEL UNDO, THROW, otherwise the RETURN ERROR goes on.
- Version 12 with catch-stop 0: a STOP raised by a CATCH block runs the FINALLY block (as OpenEdge 12.8 -catchStop 0 does); other pending STOPs still skip it.
Please review.