Results 1 to 7 of 7

Thread: Stack overflow

  1. #1
    Senior Member ckb's Avatar
    Join Date
    Mar 2006
    Posts
    923

    Default Stack overflow

    I am not sure if this is really a bug or more of a "don't do that" moment, but writing a function that references itself creates a Stack overflow.
    (I did this recently by mistake, code verified with the script below.)


    Stack overflow during ASH script: (001-ashtest.ash, line 1)

    Code:
    void SayHi() { SayHi(); }
    
    void main() {
    	print("hello world");
    	SayHi();
    }

  2. #2
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    12,180

    Default

    That's called infinite recursion.

    Don't do that.

  3. #3
    Senior Member ckb's Avatar
    Join Date
    Mar 2006
    Posts
    923

    Default

    Don't do that.
    Originally Posted by Veracity View Post
    Agreed. Hopefully others can learn from my foolish mistakes :-)

  4. #4
    Senior Member
    Join Date
    Apr 2009
    Posts
    1,856

    Default

    At least in mafia the cost of failure does not exceed "restart mafia". I have recently caused infinite loop on a database in an environment where killing the session was impossible, all triggered exceptions were immediately caught and ignored, and the admins were already gone for the day. My cost of failure was "wait 5 hours until the database session times out".

  5. #5
    Developer fronobulax's Avatar
    Join Date
    Feb 2009
    Location
    Central Virginia, USA
    Posts
    4,497

    Default

    At least in mafia the cost of failure does not exceed "restart mafia". I have recently caused infinite loop on a database in an environment where killing the session was impossible, all triggered exceptions were immediately caught and ignored, and the admins were already gone for the day. My cost of failure was "wait 5 hours until the database session times out".
    Originally Posted by xKiv View Post
    Ouch!
    Well, thank you.
    Originally Posted by Veracity View Post

  6. #6
    Senior Member
    Join Date
    Apr 2018
    Posts
    328

    Default

    At least in mafia the cost of failure does not exceed "restart mafia". I have recently caused infinite loop on a database in an environment where killing the session was impossible, all triggered exceptions were immediately caught and ignored, and the admins were already gone for the day. My cost of failure was "wait 5 hours until the database session times out".
    Originally Posted by xKiv View Post
    You didn't have permissions to send a SIGTERM or SIGKILL signal to the process? Admittedly, SIGKILL probably would have left a huge mess.

  7. #7
    Senior Member
    Join Date
    Apr 2009
    Posts
    1,856

    Default

    You didn't have permissions to send a SIGTERM or SIGKILL signal to the process? Admittedly, SIGKILL probably would have left a huge mess.
    Originally Posted by Saklad5 View Post
    Enterprise environment with strict restrictions (even if I could log in to the database server itself, which only the admins can, I wouldn't have permissions to kill processes not owned by me). We are lucky we can install tables and packages at all without the admins.
    There is a admin-provided package to kill your own sessions (going by database user/schema), but it has an explicit "you cannot do this" if the session is run from non-development environment (going by OS user)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •