Menu

#1270 Unexpected recursion leading to error 11, "Control stack full"

None
invalid
nobody
None
none
1
2014-11-08
2014-07-03
No

With ooRexx 4.2.0 the following Rexx program causes an unexpected recursion that leads to error 11: Control stack full:

  rexxCode1="::routine pp public; return '['arg(1)']'"
  rp1=.routine~new("rexxcode1", rexxcode1)
  rp1~call

  rexxCode2= "parse source fn                                               ;" -
             "say pp(fn)                                                    ;" -
             "say pp(fn) 'test():' pp(test())  -- a line comment            ;" -
             "::routine test public                                         ;" -
             "  return 'from routine test() at' .DateTime~new               ;" ;

  -- rp2=.routine~new("rexxcode2", rexxcode2, rp1~package)
  rp2=.routine~new("rexxcode2", rexxcode2)
  rp2~package~addPackage(rp1~package)
  rp2~call

Please note: rexxCode2 has no .endofline, but uses semi-colons for ending statements. Right before the routine directive a line comment is given, which causes everything else to be treated like a comment.

It is therefore unexpected that this program enters into a recursion until the control stack is full.

Discussion

  • Rick McGuire

    Rick McGuire - 2014-07-03

    This program does not give a control stack full for me, but a routine not found, which is what I would expect:

    [WindowsNT SUBROUTINE rexxcode2]
    1 - say pp(fn) 'test():' pp(test()) -- a line comment ; ::rou
    tine test public ; return 'from routin
    e test() at' .DateTime~new ;
    - Compiled method CALL with scope "Routine"
    14 - rp2~call
    Error 43 running rexxcode2 line 1: Routine not found
    Error 43.1: Could not find routine "TEST"

     
  • Rony G. Flatscher

    Yes. Running the program via Java and the ooRexx C++ interface yields error 43.1.

    Running the Rexx program I submitted on my machine gives 11.1:


    15 *-* rp2~call
     1 *-* say pp(fn) 'test():' pp(test())  -- a line comment            ; ::routine test public
            ;   return 'from routine test() at' .DateTime~new               ;
       *-* Compiled method CALL with scope "Routine"
    15 *-* rp2~call
     1 *-* say pp(fn) 'test():' pp(test())  -- a line comment            ; ::routine test public
            ;   return 'from routine test() at' .DateTime~new               ;
       *-* Compiled method CALL with scope "Routine"
    15 *-* rp2~call
     1 *-* say pp(fn) 'test():' pp(test())  -- a line comment            ; ::routine test public
            ;   return 'from routine test() at' .DateTime~new               ;
       *-* Compiled method CALL with scope "Routine"
    15 *-* rp2~call
     1 *-* say pp(fn) 'test():' pp(test())  -- a line comment            ; ::routine test public
            ;   return 'from routine test() at' .DateTime~new               ;
       *-* Compiled method CALL with scope "Routine"
    15 *-* rp2~call
     1 *-* say pp(fn) 'test():' pp(test())  -- a line comment            ; ::routine test public
            ;   return 'from routine test() at' .DateTime~new               ;
       *-* Compiled method CALL with scope "Routine"
    15 *-* rp2~call
    

    Error 11 running F:\work\svn\bsf4oorexx\trunk\samples\Java\test\test.rex line 3: Control stack full
    Error 11.1: Insufficient control stack space; cannot continue execution

    F:\work\svn\bsf4oorexx\trunk\samples\Java\test>rexx -v
    Open Object Rexx Version 4.2.0
    Build date: Feb 22 2014
    Addressing Mode: 32

    Copyright (c) IBM Corporation 1995, 2004.
    Copyright (c) RexxLA 2005-2013.
    All Rights Reserved.
    This program and the accompanying materials are made available under
    the terms of the Common Public License v1.0 which accompanies this
    distribution or at
    http://www.oorexx.org/license.html


    Even opened a new command line session and still have that control stack full error!

     
  • Rick McGuire

    Rick McGuire - 2014-07-03

    I will examine this once an example that actually shows the error is available. But from what I can see, you've somehow added a package to itself, creating a circular reference.

     
  • Rick McGuire

    Rick McGuire - 2014-07-03

    Found the undelete function!

    This is invalid. It gives a control stack full if you name the program "test.rex". The test() call locates the original file as an external call and invokes it recursively. This would have been a little more obvious had you given the program as an attachment with the original name rather than just cut-and-pasting it into the description...as well as saving the person doing the investigation a little time.

     
  • Rick McGuire

    Rick McGuire - 2014-07-03
    • status: open --> invalid
     

Anonymous
Anonymous

Add attachments
Cancel





Auth0 Logo